~dannf/ubuntu/+source/linux/+git/unstable:acpi-mbigen

Last commit made on 2016-11-10
Get this branch:
git clone -b acpi-mbigen https://git.launchpad.net/~dannf/ubuntu/+source/linux/+git/unstable
Only dann frazier can upload to this branch. If you are dann frazier please log in for upload directions.

Branch merges

Branch information

Name:
acpi-mbigen
Repository:
lp:~dannf/ubuntu/+source/linux/+git/unstable

Recent commits

1daf8da... by hanjun.guo

irqchip: mbigen: Add ACPI support

With the preparation of platform msi support and interrupt producer
in DSDT, we can add mbigen ACPI support now.

We are using _PRS methd to indicate number of irq pins instead
of num_pins in DT to avoid _DSD usage in this case.

For mbi-gen,
    Device(MBI0) {
          Name(_HID, "HISI0152")
          Name(_UID, Zero)
          Name(_CRS, ResourceTemplate() {
                  Memory32Fixed(ReadWrite, 0xa0080000, 0x10000)
          })

          Name (_PRS, ResourceTemplate() {
    Interrupt(ResourceProducer,...) {12,14,....}
          })
    }

For devices,

   Device(COM0) {
          Name(_HID, "ACPIIDxx")
          Name(_UID, Zero)
          Name(_CRS, ResourceTemplate() {
                 Memory32Fixed(ReadWrite, 0xb0030000, 0x10000)
   Interrupt(ResourceConsumer,..., "\_SB.MBI0") {12}
          })
    }

With the helpe of platform msi and interrupt producer, then devices
will get the virq from mbi-gen's irqdomain.

Signed-off-by: Hanjun Guo <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Thomas Gleixner <email address hidden>
Cc: Ma Jun <email address hidden>
[ CKT: Changes irq-mbigen, which is a driver specific to the platform
  in question:
  obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 ]

c761c40... by Kefeng Wang <email address hidden>

irqchip: mbigen: introduce mbigen_of_create_domain()

Introduce mbigen_of_create_domain() to consolidate OF related
code and prepare for ACPI later.

Signed-off-by: Kefeng Wang <email address hidden>
Signed-off-by: Hanjun Guo <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Thomas Gleixner <email address hidden>
Cc: Ma Jun <email address hidden>
[ CKT: Changes irq-mbigen, which is a driver specific to the platform
  in question:
  obj-$(CONFIG_HISILICON_IRQ_MBIGEN) += irq-mbigen.o
 ]

d24f36f... by Kefeng Wang <email address hidden>

irqchip: mbigen: drop module owner

Module owner will be set by driver core, so drop it.

Signed-off-by: Kefeng Wang <email address hidden>
Signed-off-by: Hanjun Guo <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Thomas Gleixner <email address hidden>
Cc: Ma Jun <email address hidden>
[ CKT: trivial ]

10ae882... by hanjun.guo

ACPI: irq: introduce interrupt producer

In ACPI 6.1 spec, section 19.6.62, Interrupt Resource Descriptor Macro,

Interrupt (ResourceUsage, EdgeLevel, ActiveLevel, Shared,
ResourceSourceIndex, ResourceSource, DescriptorName)
{ InterruptList } => Buffer

For the arguement ResourceUsage and DescriptorName, which means:

ResourceUsage describes whether the device consumes the specified
interrupt ( ResourceConsumer ) or produces it for use by a child
device ( ResourceProducer ).
If nothing is specified, then ResourceConsumer is assumed.

DescriptorName evaluates to a name string which refers to the
entire resource descriptor.

So it can be used for devices connecting to a specific interrupt
prodcucer instead of the main interrupt controller in MADT. In the
real world, we have irqchip such as mbi-gen which connecting to
a group of wired interrupts and then issue msi to the ITS, devices
connecting to such interrupt controller fit this scope.

For now the irq for ACPI only pointer to the main interrupt
controller's irqdomain, for devices not connecting to those
irqdomains, which need to present its irq parent, we can use
following ASL code to represent it:

Interrupt(ResourceConsumer,..., "\_SB.IRQP") {12,14,....}

then we can parse the interrupt producer with the full
path name "\_SB.IRQP".

In order to do that, we introduce a pointer interrupt_producer
in struct acpi_device, and fill it when scanning irq resources
for acpi device if it specifies the interrupt producer.

But for now when parsing the resources for acpi devices, we don't
pass the acpi device for acpi_walk_resoures() in drivers/acpi/resource.c,
so introduce a adev in struct res_proc_context to pass it as a context
to scan the interrupt resources, then finally pass to acpi_register_gsi()
to find its interrupt producer to get the virq from diffrent domains.

With steps above ready, rework acpi_register_gsi() to get other
interrupt producer if devices not connecting to main interrupt
controller.

Since we often pass NULL to acpi_register_gsi() and there is no interrupt
producer for devices connect to gicd on ARM or io-apic on X86, so it will
use the default irqdomain for those deivces and no functional changes to
those devices.

Signed-off-by: Hanjun Guo <email address hidden>
Cc: Rafael J. Wysocki <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Agustin Vega-Frias <email address hidden>
Cc: Lorenzo Pieralisi <email address hidden>
[ CKT: Touches generic code. The code path for existing systems looks
  functionally the same, just reorganized. The new code should only run on
  systems that support this HW. But, I'd suggest someone w/ more ACPI
  experience than me take a look. ]

9b8d7d7... by hanjun.guo

msi: platform: make platform_msi_create_device_domain() ACPI aware

With the platform msi domain created for ITS, irqchip such as
mbi-gen connecting ITS, which needs ctreate its own irqdomain.

Fortunately with the platform msi support upstreamed by Marc,
we just need to add minor code to make it run properly.

platform_msi_create_device_domain() is almost ready for ACPI use
except of_node_to_fwnode() is for dt only, make it ACPI aware then
things will work in both DTS and ACPI.

Signed-off-by: Hanjun Guo <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Greg KH <email address hidden>
Cc: Thomas Gleixner <email address hidden>
Cc: Greg KH <email address hidden>
[ CKT: This touches generic platform-msi code. However, it is a one-line
  change that seems obviously correct to me. By looking at of_node_to_fwnode(),
  you can see that it is just returning dev->fwnode. ]

a879334... by hanjun.guo

ACPI: platform: setup MSI domain for ACPI based platform device

With the platform msi domain created, we can set up the msi domain
for a platform device when it's probed.

In order to do that, we need to get the domain that the platform
device connecting to, so the iort_get_platform_device_domain() is
introduced to retrieve the domain from iort.

After the domain is retrieved, we need a proper way to set the
domain to paltform device, as some platform devices such as an
irqchip needs the msi irqdomain to be the interrupt parent domain,
we need to get irqdomain before platform device is probed but after
the platform device is allocated, so introduce a callback (pre_add_cb)
in pdevinfo to prepare firmware related information which is needed
for device probe, then set the msi domain in that callback.

Signed-off-by: Hanjun Guo <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Rafael J. Wysocki <email address hidden>
Cc: Greg KH <email address hidden>
Cc: Lorenzo Pieralisi <email address hidden>
Cc: Thomas Gleixner <email address hidden>
[ CKT: This touches the generic acpi-platform code, but it is a no-op
  on !arm64. acpi_configure_pmsi_domain() is only implemented when
  CONFIG_ACPI_IORT is enabled, and that is an arm64-only Kconfig setting ]

987e119... by hanjun.guo

ACPI: ARM64: IORT: rework iort_node_get_id()

iort_node_get_id() has two output, one is the mapped ids,
the other is the referenced parent node which is returned
from the function.

For now we need a API just return its parent node for
single mapping, so just update this function slightly then
reuse it later.

Signed-off-by: Hanjun Guo <email address hidden>
Cc: Lorenzo Pieralisi <email address hidden>
Cc: Marc Zyngier <email address hidden>
[ CKT: arm64-only ]

1d887c8... by hanjun.guo

irqchip: gicv3-its: platform-msi: scan MADT to create platform msi domain

With the introduction of its_pmsi_init_one(), we can add some code
on top for ACPI support of platform MSI.

We are scanning the MADT table to get the ITS entry(ies), then use
the information to create the platform msi domain for devices connect
to it, just like the PCI MSI for ITS did.

Signed-off-by: Hanjun Guo <email address hidden>
Tested-by: Sinan Kaya <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Tomasz Nowicki <email address hidden>
Cc: Thomas Gleixner <email address hidden>
[ CKT: arm64-only (GICv3 requires ARMv8-A compliance) ]

34dd83b... by hanjun.guo

irqchip: gicv3-its: platform-msi: refactor its_pmsi_init() to prepare for ACPI

Introduce its_pmsi_init_one() to refactor the code to isolate
ACPI&DT common code to prepare for ACPI later.

Signed-off-by: Hanjun Guo <email address hidden>
Tested-by: Sinan Kaya <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Tomasz Nowicki <email address hidden>
Cc: Thomas Gleixner <email address hidden>
[ CKT: arm64-only (GICv3 requires ARMv8-A compliance) ]

aedaba7... by hanjun.guo

ACPI: platform-msi: retrieve dev id from IORT

For devices connecting to ITS, it needs dev id to identify
itself, and this dev id is represented in the IORT table in
named componant node [1] for platform devices, so in this
patch we will scan the IORT to retrieve device's dev id.

Introduce iort_pmsi_get_dev_id() with pointer dev passed
in for that purpose.

[1]: https://static.docs.arm.com/den0049/b/DEN0049B_IO_Remapping_Table.pdf

Signed-off-by: Hanjun Guo <email address hidden>
Tested-by: Sinan Kaya <email address hidden>
Cc: Marc Zyngier <email address hidden>
Cc: Lorenzo Pieralisi <email address hidden>
Cc: Tomasz Nowicki <email address hidden>
Cc: Thomas Gleixner <email address hidden>
[ CKT: arm64-only (GICv3 requires ARMv8-A compliance) ]