Xen: ARM: Support for mapping OperationRegion in ACPI ASL
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.
Signature · 8 lines
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 [email protected] https://lists.xen.org/xen-devel
Quoted 33 lines · Jiandi An
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
_CRSin ACPI is handled by dom0 requesting Xen to map as platform devices are added. https://lwn.net/Articles/674666/ provided servicexen_map_device_mmio()in dom0 to call Xen to map and it's done so by registeringxen_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
Quoted 1 line
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 inacpi_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
[email protected]
https://lists.xen.org/xen-devel
Re: Xen: Support for mapping OperationRegion in ACPI ASL
This is actually not an ARM specific question, so changing the subject and CC'ing more people.
Quoted 34 lines · Konrad Rzeszutek Wilk
Quoted 33 lines · Jiandi An
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
_CRSin ACPI is handled by dom0 requesting Xen to map as platform devices are added. https://lwn.net/Articles/674666/ provided servicexen_map_device_mmio()in dom0 to call Xen to map and it's done so by registeringxen_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
Quoted 6 lines
Quoted 1 line
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 inacpi_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
[email protected]
https://lists.xen.org/xen-devel
Re: Xen: Support for mapping OperationRegion in ACPI ASL
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 20.12.16 at 00:01, <[email protected]> wrote:
This is actually not an ARM specific question, so changing the subject and CC'ing more people.
Quoted 2 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Jiandi An
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.
Quoted 2 lines
Quoted 2 lines
Some context here. Mapping of resources specificed under
_CRSin ACPI is
Quoted 8 lines
handled by dom0 requesting Xen to map as platform devices are added.
https://lwn.net/Articles/674666/ provided servicexen_map_device_mmio()in dom0 to call Xen to map and it's done so by registeringxen_platform_notifier()platform bus driver. This covers the platform devices.Quoted 2 lines
Quoted 2 lines
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
[email protected]
https://lists.xen.org/xen-devel
Re: Xen: Support for mapping OperationRegion in ACPI ASL
Quoted 18 lines · Jan Beulich
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 20.12.16 at 00:01, <[email protected]> wrote:
This is actually not an ARM specific question, so changing the subject and CC'ing more people.
Quoted 2 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Jiandi An
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.
Quoted 2 lines
Quoted 2 lines
Some context here. Mapping of resources specificed under
_CRSin ACPI ishandled by dom0 requesting Xen to map as platform devices are added.
https://lwn.net/Articles/674666/ provided servicexen_map_device_mmio()in dom0 to call Xen to map and it's done so by registeringxen_platform_notifier()platform bus driver. This covers the platform devices.Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
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
[email protected]
https://lists.xen.org/xen-devel
Re: Xen: Support for mapping OperationRegion in ACPI ASL
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 20.12.16 at 23:50, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 20.12.16 at 00:01, <[email protected]> wrote:
This is actually not an ARM specific question, so changing the subject and CC'ing more people.
Quoted 2 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Jiandi An
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
Quoted 9 lines
Quoted 9 lines
mapping OperationRegion.
Quoted 2 lines
Quoted 2 lines
Some context here. Mapping of resources specificed under
_CRSin ACPI ishandled by dom0 requesting Xen to map as platform devices are added.
https://lwn.net/Articles/674666/ provided servicexen_map_device_mmio()in dom0 to call Xen to map and it's done so by registeringxen_platform_notifier()platform bus driver. This covers the platform devices.Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
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 ...
Quoted 5 lines
Please correct me if I am wrong, but we are talking about ACPI initialization here. In fact,
acpi_initwas 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
[email protected]
https://lists.xen.org/xen-devel
Re: Xen: Support for mapping OperationRegion in ACPI ASL
Quoted 46 lines · Jan Beulich
Quoted 29 lines
Quoted 1 line
Quoted 1 line · On 20.12.16 at 23:50, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 20.12.16 at 00:01, <[email protected]> wrote:
This is actually not an ARM specific question, so changing the subject and CC'ing more people.
Quoted 2 lines · Konrad Rzeszutek Wilk
Quoted 1 line · Jiandi An
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
Quoted 9 lines
Quoted 9 lines
mapping OperationRegion.
Quoted 2 lines
Quoted 2 lines
Some context here. Mapping of resources specificed under
_CRSin ACPI ishandled by dom0 requesting Xen to map as platform devices are added.
https://lwn.net/Articles/674666/ provided servicexen_map_device_mmio()in dom0 to call Xen to map and it's done so by registeringxen_platform_notifier()platform bus driver. This covers the platform devices.Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
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 ...
Quoted 5 lines
Please correct me if I am wrong, but we are talking about ACPI initialization here. In fact,
acpi_initwas 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 includeacpi_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
Quoted 2 lines
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
[email protected]
https://lists.xen.org/xen-devel