All of lore.kernel.org
 help / color / mirror / Atom feed
* Xen: ARM: Support for mapping OperationRegion in ACPI ASL
@ 2016-12-14  1:14 Jiandi An
  2016-12-14 13:40 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 7+ messages in thread
From: Jiandi An @ 2016-12-14  1:14 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, sstabellini, shannon.zhao, shankerd

Hi Guys,

Xen currently does not handle mapping of MMIO regions specified under OperationRegion in ACPI ASL.  OperationRegion is well defined in ACPI specification.  I'm seeking for architectural direction on adding support for mapping OperationRegion.

Some context here.  Mapping of resources specificed under _CRS in ACPI is handled by dom0 requesting Xen to map as platform devices are added.  https://lwn.net/Articles/674666/ provided service xen_map_device_mmio() in dom0 to call Xen to map and it's done so by registering xen_platform_notifier() platform bus driver.  This covers the platform devices.

The OperationRegion access in dom0 is in acpica path.  The following is a stack of the code path where OperationRegion is parsed.  acpi_ex_system_memory_space_handler() gets the parsed address specified in OperationRegion in ACPI and maps it then performs the memory read or write.  

acpi_ex_system_memory_space_handler+0x378/0x424
acpi_ev_address_space_dispatch+0x294/0x310
acpi_ex_access_region+0x3c0/0x468
acpi_ex_field_datum_io+0x14c/0x380
acpi_ex_extract_from_field+0xe8/0x2f4
acpi_ex_read_data_from_field+0x330/0x38c
acpi_ex_resolve_node_to_value+0x310/0x3fc
acpi_ex_resolve_to_value+0x354/0x3e8
acpi_ds_evaluate_name_path+0xa4/0x15c
acpi_ds_exec_end_op+0xbc/0x6c8
acpi_ps_parse_loop+0x7ac/0x840
acpi_ps_parse_aml+0x1c4/0x434
acpi_ps_execute_method+0x1f0/0x2a0
acpi_ns_evaluate+0x2e4/0x424
acpi_ut_evaluate_object+0xb0/0x250
acpi_ut_execute_STA+0xb0/0x164
acpi_ns_init_one_device+0xac/0x250
acpi_ns_walk_namespace+0x108/0x254
acpi_ns_initialize_devices+0x274/0x35c
acpi_initialize_objects+0x90/0xf0
acpi_init+0xc0/0x30c
do_one_initcall+0x44/0x138
kernel_init_freeable+0x148/0x1ec
kernel_init+0x18/0x108

The workaround in testing for handling OperationRegion I did is to call xen_map_device_mmio() to map the resource specificied in OperationRegion if it's dom0 running under XEN in acpi_ex_system_memory_space_handler().  But this is a fairly generic ACPI code path.  Looking for achitectural suggestion to properly handle OperationRegion for Xen on ARM.

Thanks.

-- 
Jiandi An
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Xen: ARM: Support for mapping OperationRegion in ACPI ASL
  2016-12-14  1:14 Xen: ARM: Support for mapping OperationRegion in ACPI ASL Jiandi An
@ 2016-12-14 13:40 ` Konrad Rzeszutek Wilk
  2016-12-19 23:01   ` Xen: " Stefano Stabellini
  0 siblings, 1 reply; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-12-14 13:40 UTC (permalink / raw)
  To: Jiandi An; +Cc: Julien Grall, sstabellini, shannon.zhao, shankerd, xen-devel

On Tue, Dec 13, 2016 at 07:14:27PM -0600, Jiandi An wrote:
> Hi Guys,
> 
> Xen currently does not handle mapping of MMIO regions specified under OperationRegion in ACPI ASL.  OperationRegion is well defined in ACPI specification.  I'm seeking for architectural direction on adding support for mapping OperationRegion.
> 
> Some context here.  Mapping of resources specificed under _CRS in ACPI is handled by dom0 requesting Xen to map as platform devices are added.  https://lwn.net/Articles/674666/ provided service xen_map_device_mmio() in dom0 to call Xen to map and it's done so by registering xen_platform_notifier() platform bus driver.  This covers the platform devices.
> 
> The OperationRegion access in dom0 is in acpica path.  The following is a stack of the code path where OperationRegion is parsed.  acpi_ex_system_memory_space_handler() gets the parsed address specified in OperationRegion in ACPI and maps it then performs the memory read or write.  
> 
> acpi_ex_system_memory_space_handler+0x378/0x424
> acpi_ev_address_space_dispatch+0x294/0x310
> acpi_ex_access_region+0x3c0/0x468
> acpi_ex_field_datum_io+0x14c/0x380
> acpi_ex_extract_from_field+0xe8/0x2f4
> acpi_ex_read_data_from_field+0x330/0x38c
> acpi_ex_resolve_node_to_value+0x310/0x3fc
> acpi_ex_resolve_to_value+0x354/0x3e8
> acpi_ds_evaluate_name_path+0xa4/0x15c
> acpi_ds_exec_end_op+0xbc/0x6c8
> acpi_ps_parse_loop+0x7ac/0x840
> acpi_ps_parse_aml+0x1c4/0x434
> acpi_ps_execute_method+0x1f0/0x2a0
> acpi_ns_evaluate+0x2e4/0x424
> acpi_ut_evaluate_object+0xb0/0x250
> acpi_ut_execute_STA+0xb0/0x164
> acpi_ns_init_one_device+0xac/0x250
> acpi_ns_walk_namespace+0x108/0x254
> acpi_ns_initialize_devices+0x274/0x35c
> acpi_initialize_objects+0x90/0xf0
> acpi_init+0xc0/0x30c
> do_one_initcall+0x44/0x138
> kernel_init_freeable+0x148/0x1ec
> kernel_init+0x18/0x108
> 
> The workaround in testing for handling OperationRegion I did is to call xen_map_device_mmio() to map the resource specificied in OperationRegion if it's dom0 running under XEN in acpi_ex_system_memory_space_handler().  But this is a fairly generic ACPI code path.  Looking for achitectural suggestion to properly handle OperationRegion for Xen on ARM.

The ACPI code path obviously calls the underlaying OS code to map it.
Could this path have an wrapper around it (so one could register
different underlaying 'map_device_mmio' function calls)?

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Xen: Support for mapping OperationRegion in ACPI ASL
  2016-12-14 13:40 ` Konrad Rzeszutek Wilk
@ 2016-12-19 23:01   ` Stefano Stabellini
  2016-12-20  7:56     ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2016-12-19 23:01 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: jgross, sstabellini, andrew.cooper3, Jiandi An, xen-devel,
	Julien Grall, shannon.zhao, JBeulich, boris.ostrovsky, shankerd,
	roger.pau

This is actually not an ARM specific question, so changing the subject
and CC'ing more people.

On Wed, 14 Dec 2016, Konrad Rzeszutek Wilk wrote:
> On Tue, Dec 13, 2016 at 07:14:27PM -0600, Jiandi An wrote:
> > Hi Guys,
> > 
> > Xen currently does not handle mapping of MMIO regions specified under OperationRegion in ACPI ASL.  OperationRegion is well defined in ACPI specification.  I'm seeking for architectural direction on adding support for mapping OperationRegion.
> > 
> > Some context here.  Mapping of resources specificed under _CRS in ACPI is handled by dom0 requesting Xen to map as platform devices are added.  https://lwn.net/Articles/674666/ provided service xen_map_device_mmio() in dom0 to call Xen to map and it's done so by registering xen_platform_notifier() platform bus driver.  This covers the platform devices.
> > 
> > The OperationRegion access in dom0 is in acpica path.  The following is a stack of the code path where OperationRegion is parsed.  acpi_ex_system_memory_space_handler() gets the parsed address specified in OperationRegion in ACPI and maps it then performs the memory read or write.  
> > 
> > acpi_ex_system_memory_space_handler+0x378/0x424
> > acpi_ev_address_space_dispatch+0x294/0x310
> > acpi_ex_access_region+0x3c0/0x468
> > acpi_ex_field_datum_io+0x14c/0x380
> > acpi_ex_extract_from_field+0xe8/0x2f4
> > acpi_ex_read_data_from_field+0x330/0x38c
> > acpi_ex_resolve_node_to_value+0x310/0x3fc
> > acpi_ex_resolve_to_value+0x354/0x3e8
> > acpi_ds_evaluate_name_path+0xa4/0x15c
> > acpi_ds_exec_end_op+0xbc/0x6c8
> > acpi_ps_parse_loop+0x7ac/0x840
> > acpi_ps_parse_aml+0x1c4/0x434
> > acpi_ps_execute_method+0x1f0/0x2a0
> > acpi_ns_evaluate+0x2e4/0x424
> > acpi_ut_evaluate_object+0xb0/0x250
> > acpi_ut_execute_STA+0xb0/0x164
> > acpi_ns_init_one_device+0xac/0x250
> > acpi_ns_walk_namespace+0x108/0x254
> > acpi_ns_initialize_devices+0x274/0x35c
> > acpi_initialize_objects+0x90/0xf0
> > acpi_init+0xc0/0x30c
> > do_one_initcall+0x44/0x138
> > kernel_init_freeable+0x148/0x1ec
> > kernel_init+0x18/0x108
> > 
> > The workaround in testing for handling OperationRegion I did is to call xen_map_device_mmio() to map the resource specificied in OperationRegion if it's dom0 running under XEN in acpi_ex_system_memory_space_handler().  But this is a fairly generic ACPI code path.  Looking for achitectural suggestion to properly handle OperationRegion for Xen on ARM.
> 
> The ACPI code path obviously calls the underlaying OS code to map it.
> Could this path have an wrapper around it (so one could register
> different underlaying 'map_device_mmio' function calls)?
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Xen: Support for mapping OperationRegion in ACPI ASL
  2016-12-19 23:01   ` Xen: " Stefano Stabellini
@ 2016-12-20  7:56     ` Jan Beulich
  2016-12-20 22:50       ` Stefano Stabellini
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2016-12-20  7:56 UTC (permalink / raw)
  To: Jiandi An, Stefano Stabellini, Konrad Rzeszutek Wilk
  Cc: Juergen Gross, andrew.cooper3, xen-devel, Julien Grall,
	shannon.zhao, boris.ostrovsky, shankerd, roger.pau

>>> On 20.12.16 at 00:01, <sstabellini@kernel.org> wrote:
> This is actually not an ARM specific question, so changing the subject
> and CC'ing more people.
> 
> On Wed, 14 Dec 2016, Konrad Rzeszutek Wilk wrote:
>> On Tue, Dec 13, 2016 at 07:14:27PM -0600, Jiandi An wrote:
>> > Xen currently does not handle mapping of MMIO regions specified under 
> OperationRegion in ACPI ASL.  OperationRegion is well defined in ACPI 
> specification.  I'm seeking for architectural direction on adding support for 
> mapping OperationRegion.
>> > 
>> > Some context here.  Mapping of resources specificed under _CRS in ACPI is 
> handled by dom0 requesting Xen to map as platform devices are added.  
> https://lwn.net/Articles/674666/ provided service xen_map_device_mmio() in 
> dom0 to call Xen to map and it's done so by registering 
> xen_platform_notifier() platform bus driver.  This covers the platform 
> devices.
>> > 
>> > The OperationRegion access in dom0 is in acpica path.  The following is a 
> stack of the code path where OperationRegion is parsed.  

But aren't such regions required to be claimed by resource
declarations elsewhere? I don't think the mapping (into the p2m)
should happen during an access attempt, but much earlier. But
perhaps I'm missing some context ...

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Xen: Support for mapping OperationRegion in ACPI ASL
  2016-12-20  7:56     ` Jan Beulich
@ 2016-12-20 22:50       ` Stefano Stabellini
  2016-12-22  7:48         ` Jan Beulich
  0 siblings, 1 reply; 7+ messages in thread
From: Stefano Stabellini @ 2016-12-20 22:50 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Juergen Gross, Stefano Stabellini, andrew.cooper3, Jiandi An,
	xen-devel, Julien Grall, shannon.zhao, boris.ostrovsky, shankerd,
	roger.pau

On Tue, 20 Dec 2016, Jan Beulich wrote:
> >>> On 20.12.16 at 00:01, <sstabellini@kernel.org> wrote:
> > This is actually not an ARM specific question, so changing the subject
> > and CC'ing more people.
> > 
> > On Wed, 14 Dec 2016, Konrad Rzeszutek Wilk wrote:
> >> On Tue, Dec 13, 2016 at 07:14:27PM -0600, Jiandi An wrote:
> >> > Xen currently does not handle mapping of MMIO regions specified under 
> > OperationRegion in ACPI ASL.  OperationRegion is well defined in ACPI 
> > specification.  I'm seeking for architectural direction on adding support for 
> > mapping OperationRegion.
> >> > 
> >> > Some context here.  Mapping of resources specificed under _CRS in ACPI is 
> > handled by dom0 requesting Xen to map as platform devices are added.  
> > https://lwn.net/Articles/674666/ provided service xen_map_device_mmio() in 
> > dom0 to call Xen to map and it's done so by registering 
> > xen_platform_notifier() platform bus driver.  This covers the platform 
> > devices.
> >> > 
> >> > The OperationRegion access in dom0 is in acpica path.  The following is a 
> > stack of the code path where OperationRegion is parsed.  
> 
> But aren't such regions required to be claimed by resource
> declarations elsewhere? I don't think the mapping (into the p2m)
> should happen during an access attempt, but much earlier. But
> perhaps I'm missing some context ...

Please correct me if I am wrong, but we are talking about ACPI
initialization here. In fact, acpi_init was one of the first functions
in the callstack of the previous email. So yes, we are trying to map the
regions when they are discovered during ACPI initialization, which is as
early as possible I think.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Xen: Support for mapping OperationRegion in ACPI ASL
  2016-12-20 22:50       ` Stefano Stabellini
@ 2016-12-22  7:48         ` Jan Beulich
  2017-01-03 19:10           ` Stefano Stabellini
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2016-12-22  7:48 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Juergen Gross, andrew.cooper3, Jiandi An, xen-devel,
	Julien Grall, shannon.zhao, boris.ostrovsky, shankerd, roger.pau

>>> On 20.12.16 at 23:50, <sstabellini@kernel.org> wrote:
> On Tue, 20 Dec 2016, Jan Beulich wrote:
>> >>> On 20.12.16 at 00:01, <sstabellini@kernel.org> wrote:
>> > This is actually not an ARM specific question, so changing the subject
>> > and CC'ing more people.
>> > 
>> > On Wed, 14 Dec 2016, Konrad Rzeszutek Wilk wrote:
>> >> On Tue, Dec 13, 2016 at 07:14:27PM -0600, Jiandi An wrote:
>> >> > Xen currently does not handle mapping of MMIO regions specified under 
>> > OperationRegion in ACPI ASL.  OperationRegion is well defined in ACPI 
>> > specification.  I'm seeking for architectural direction on adding support 
> for 
>> > mapping OperationRegion.
>> >> > 
>> >> > Some context here.  Mapping of resources specificed under _CRS in ACPI is 
>> > handled by dom0 requesting Xen to map as platform devices are added.  
>> > https://lwn.net/Articles/674666/ provided service xen_map_device_mmio() in 
>> > dom0 to call Xen to map and it's done so by registering 
>> > xen_platform_notifier() platform bus driver.  This covers the platform 
>> > devices.
>> >> > 
>> >> > The OperationRegion access in dom0 is in acpica path.  The following is a 
>> > stack of the code path where OperationRegion is parsed.  
>> 
>> But aren't such regions required to be claimed by resource
>> declarations elsewhere? I don't think the mapping (into the p2m)
>> should happen during an access attempt, but much earlier. But
>> perhaps I'm missing some context ...
> 
> Please correct me if I am wrong, but we are talking about ACPI
> initialization here. In fact, acpi_init was one of the first functions
> in the callstack of the previous email. So yes, we are trying to map the
> regions when they are discovered during ACPI initialization, which is as
> early as possible I think.

Yes and no: Yes - we are in the context of acpi_init(). But no, the
mapping did not get established prior to the first access, or else
the call stack wouldn't include

acpi_ex_system_memory_space_handler+0x378/0x424
acpi_ev_address_space_dispatch+0x294/0x310
acpi_ex_access_region+0x3c0/0x468
acpi_ex_field_datum_io+0x14c/0x380
acpi_ex_extract_from_field+0xe8/0x2f4
acpi_ex_read_data_from_field+0x330/0x38c

I would expect resource claiming to precede this, and that would
then be where the mapping should also be requested.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Xen: Support for mapping OperationRegion in ACPI ASL
  2016-12-22  7:48         ` Jan Beulich
@ 2017-01-03 19:10           ` Stefano Stabellini
  0 siblings, 0 replies; 7+ messages in thread
From: Stefano Stabellini @ 2017-01-03 19:10 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Juergen Gross, Stefano Stabellini, andrew.cooper3, Jiandi An,
	xen-devel, Julien Grall, shannon.zhao, boris.ostrovsky, shankerd,
	roger.pau

On Thu, 22 Dec 2016, Jan Beulich wrote:
> >>> On 20.12.16 at 23:50, <sstabellini@kernel.org> wrote:
> > On Tue, 20 Dec 2016, Jan Beulich wrote:
> >> >>> On 20.12.16 at 00:01, <sstabellini@kernel.org> wrote:
> >> > This is actually not an ARM specific question, so changing the subject
> >> > and CC'ing more people.
> >> > 
> >> > On Wed, 14 Dec 2016, Konrad Rzeszutek Wilk wrote:
> >> >> On Tue, Dec 13, 2016 at 07:14:27PM -0600, Jiandi An wrote:
> >> >> > Xen currently does not handle mapping of MMIO regions specified under 
> >> > OperationRegion in ACPI ASL.  OperationRegion is well defined in ACPI 
> >> > specification.  I'm seeking for architectural direction on adding support 
> > for 
> >> > mapping OperationRegion.
> >> >> > 
> >> >> > Some context here.  Mapping of resources specificed under _CRS in ACPI is 
> >> > handled by dom0 requesting Xen to map as platform devices are added.  
> >> > https://lwn.net/Articles/674666/ provided service xen_map_device_mmio() in 
> >> > dom0 to call Xen to map and it's done so by registering 
> >> > xen_platform_notifier() platform bus driver.  This covers the platform 
> >> > devices.
> >> >> > 
> >> >> > The OperationRegion access in dom0 is in acpica path.  The following is a 
> >> > stack of the code path where OperationRegion is parsed.  
> >> 
> >> But aren't such regions required to be claimed by resource
> >> declarations elsewhere? I don't think the mapping (into the p2m)
> >> should happen during an access attempt, but much earlier. But
> >> perhaps I'm missing some context ...
> > 
> > Please correct me if I am wrong, but we are talking about ACPI
> > initialization here. In fact, acpi_init was one of the first functions
> > in the callstack of the previous email. So yes, we are trying to map the
> > regions when they are discovered during ACPI initialization, which is as
> > early as possible I think.
> 
> Yes and no: Yes - we are in the context of acpi_init(). But no, the
> mapping did not get established prior to the first access, or else
> the call stack wouldn't include
> 
> acpi_ex_system_memory_space_handler+0x378/0x424
> acpi_ev_address_space_dispatch+0x294/0x310
> acpi_ex_access_region+0x3c0/0x468
> acpi_ex_field_datum_io+0x14c/0x380
> acpi_ex_extract_from_field+0xe8/0x2f4
> acpi_ex_read_data_from_field+0x330/0x38c
> 
> I would expect resource claiming to precede this, and that would
> then be where the mapping should also be requested.

Good point.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-03 19:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-14  1:14 Xen: ARM: Support for mapping OperationRegion in ACPI ASL Jiandi An
2016-12-14 13:40 ` Konrad Rzeszutek Wilk
2016-12-19 23:01   ` Xen: " Stefano Stabellini
2016-12-20  7:56     ` Jan Beulich
2016-12-20 22:50       ` Stefano Stabellini
2016-12-22  7:48         ` Jan Beulich
2017-01-03 19:10           ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.