ACPI / GED: use late init to allow other drivers init
PATCH 1/1 ACPI / GED: use late init to allow other drivers init
GED driver is currently set up as a platform driver. On modern operating systems, most of the drivers are compiled as kernel modules. It is possible that a GED interrupt event is received and the driver such as GHES/GPIO/I2C to service it is not available yet. To accommodate this use case, delay GED driver load to the late init phase.
--- drivers/acpi/evged.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/acpi/evged.c +7 -1
@@ -151,4 +151,10 @@ static int ged_probe(struct platform_device *pdev) .acpi_match_table = ACPI_PTR(ged_acpi_ids), }, }; -builtin_platform_driver (ged_driver); + +static __init int ged_init (void ) +{ +return platform_driver_register (&ged_driver); +} + +late_initcall (ged_init);
Signature · 1 line
1.9.1
Rafael J. Wysocki
maintainerQuoted 17 lines · Sinan Kaya
GED driver is currently set up as a platform driver. On modern operating systems, most of the drivers are compiled as kernel modules. It is possible that a GED interrupt event is received and the driver such as GHES/GPIO/I2C to service it is not available yet. To accommodate this use case, delay GED driver load to the late init phase.
Signed-off-by Sinan Kaya <[email protected]>--- drivers/acpi/evged.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/acpi/evged.c +0
-0@@ -151,4 +151,10 @@ static int ged_probe(struct platform_device *pdev) .acpi_match_table = ACPI_PTR(ged_acpi_ids),
drivers/acpi/evged.c static int ged_probe(struct platform_device *pdev) · line 160
Quoted 10 lines
drivers/acpi/evged.c +7
-1}, }; -builtin_platform_driver (ged_driver); + +static __init int ged_init (void ) +{ +return platform_driver_register (&ged_driver); +} + +late_initcall (ged_init);
Does this fix the problem?
What about if the module in question is loaded after running late_initcalls?
Thanks,
Rafael
Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line
+late_initcall(ged_init);
Does this fix the problem?
What about if the module in question is loaded after running
late_initcalls?
This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
However, I'm open to improvements. Do you have a better suggestion? I can try to add some _DEP stuff if it is present, but I remember Linux doesn't like _DEP stuff too much.
Signature · 3 lines
Sinan Kaya 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.
Quoted 4 lines · Sinan Kaya
Quoted 3 lines · Rafael J. Wysocki
Quoted 1 line
+late_initcall(ged_init);
Does this fix the problem?
Quoted 9 lines
Quoted 1 line
What about if the module in question is loaded after running
late_initcalls?This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
However, I'm open to improvements. Do you have a better suggestion? I can try to add some
_DEPstuff if it is present, but I remember Linux doesn't like_DEPstuff too much.
I forgot to mention that GED driver is a built-in module.
Signature · 3 lines
Sinan Kaya 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.
Rafael J. Wysocki
maintainerQuoted 4 lines · Sinan Kaya
Quoted 3 lines · Rafael J. Wysocki
Quoted 1 line
+late_initcall(ged_init);
Does this fix the problem?
Quoted 8 lines
Quoted 1 line
What about if the module in question is loaded after running
late_initcalls?This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
However, I'm open to improvements. Do you have a better suggestion? I can try to add some
_DEPstuff if it is present, but I remember Linux doesn't like_DEPstuff too much.
My point is that nothing guarantees a specific ordering or timing of module loading in general, so moving stuff to different initcall levels does not really help 100% of the time.
Thanks,
Rafael
Hi Rafael,
Quoted 10 lines · Rafael J. Wysocki
Quoted 9 lines · Sinan Kaya
Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line
+late_initcall(ged_init);
Does this fix the problem?
What about if the module in question is loaded after running
late_initcalls?This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
Quoted 8 lines
Quoted 3 lines
However, I'm open to improvements. Do you have a better suggestion? I can try to add some
_DEPstuff if it is present, but I remember Linux doesn't like_DEPstuff too much.My point is that nothing guarantees a specific ordering or timing of module loading in general, so moving stuff to different initcall levels does not really help 100% of the time.
I was thinking about this today. I agree that this is not a complete solution.
I'm interested in drivers that are either built-in or present in the initramfs. Drivers that participate in GED work are considered essential drivers. I expect these essential drivers to be present in early boot phase.
I can certainly improve the commit message.
As long as the drivers are built-in or available in initramfs, I expect this to work. I want to focus on this use case.
static char *initcall_level_names[] __initdata = {
"early",
"core",
"postcore",
"arch",
"subsys",
"fs",
"device",
"late",
};static void __init do_initcall_level(int level)
{
...
for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++)
do_one_initcall(*fn);
}
Given these constraints, doesn't this guarantee the order of initialization for built-in and initramfs modules?
Of course, this won't also play nice with another driver module that requires late_init. Maybe, this is 1% of the case.
If the driver gets pulled in from the rootfs via modules.conf, then this will definitely not work as you indicated.
My proposal is to explore the presence of _DEP to reach to %100. Here is an example
GED OBJECT
{
Name(_DEP, "Some other object")
}
I see that ACPI core checks the presence of _DEP value in acpi_device_dep_initialize() and it won't load the GED driver until dependencies are met if I got it right.
acpi_walk_dep_device_list() gets called from external drivers that need to unblock the dependent object. acpi_gpiochip_add() seems to take care of this for GPIO. i2c_acpi_install_space_handler() seems to take care of this for I2C.
We can potentially add acpi_walk_dep_device_list() to GHES driver for completeness. Then, all FW needs to do is set up a dependency from GED object to its required objects.
Please let me know if I'm missing something.
Quoted 7 lines
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Sinan
Signature · 3 lines
Sinan Kaya 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.
Quoted 7 lines · Sinan Kaya
Quoted 5 lines · Rafael J. Wysocki
+late_initcall(ged_init);
Does this fix the problem?What about if the module in question is loaded after running
late_initcalls?
Quoted 7 lines
This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
However, I'm open to improvements. Do you have a better suggestion? I can try to add some
_DEPstuff if it is present, but I remember Linux doesn't like_DEPstuff too much.
Would it be possible to solve this by just returning -EPROBE_DEFER from the ->probe hook if the devices you depend on are not bound yet?
Alternatively, would it be possible to solve it with a struct device_link?
Thanks,
Lukas
Quoted 12 lines · Lukas Wunner
Quoted 11 lines · Sinan Kaya
Quoted 5 lines · Rafael J. Wysocki
+late_initcall(ged_init);
Does this fix the problem?What about if the module in question is loaded after running
late_initcalls?This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
Quoted 7 lines
Quoted 3 lines
However, I'm open to improvements. Do you have a better suggestion? I can try to add some
_DEPstuff if it is present, but I remember Linux doesn't like_DEPstuff too much.Would it be possible to solve this by just returning -EPROBE_DEFER from the ->probe hook if the devices you depend on are not bound yet?
I'm not sure.
Quoted 1 line
Alternatively, would it be possible to solve it with a struct
device_link?
I wasn't aware of device_link concept. This is something that I will keep in my mind when I'm dealing with producer/consumer problems with known device driver instances. It looked very useful.
Here is how the overall relationship between drivers.
| GED | <---> | Platform specific ACPI AML | <----> Vendor GPIO
<----> Vendor I2C
<----> ACPI GHES
<----> Some other driverThe problem with Generic Event Device (GED) is that it produces event notification facility to the platform specific AML code and GED doesn't have any idea about the consumers of these interrupts or what platform AML does.
GED only sees the interrupts that it needs to register and knows the ASL code it needs to execute when that interrupt happens.
It is possible for AML code not to use any of these drivers or require some arbitrary driver as well as vendor specific drivers. It is totally up to the firmware to decide what to do with this event.
My proposal was to require platform AML code to indicate the dependencies between GED and drivers on the right side of the picture via _DEP as this cannot be done via normal kernel mechanisms.
This approach might work in general. However, it also has its own caveats.
All of these drivers on the right side are unrelated to each other. Some operating system can implement a subset of these drivers.
If I include the dependencies, GED will never load for partial driver situations. This is also a deal breaker.
Why would you break some other feature if your OS doesn't support RAS as an example?
Given all these lose bindings and no driver association, where do we go from here?
I consider GED as a light version of Embedded controller (EC) implementation.
How is this problem solved for EC as it has the same problem?
Quoted 5 lines
Thanks,
Lukas
Signature · 3 lines
Sinan Kaya 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.
Quoted 63 lines · Sinan Kaya
Quoted 12 lines · Lukas Wunner
Quoted 11 lines · Sinan Kaya
Quoted 5 lines · Rafael J. Wysocki
+late_initcall(ged_init);
Does this fix the problem?What about if the module in question is loaded after running
late_initcalls?This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
Quoted 7 lines
Quoted 3 lines
However, I'm open to improvements. Do you have a better suggestion? I can try to add some
_DEPstuff if it is present, but I remember Linux doesn't like_DEPstuff too much.Would it be possible to solve this by just returning -EPROBE_DEFER from the ->probe hook if the devices you depend on are not bound yet?
I'm not sure.
Quoted 1 line
Alternatively, would it be possible to solve it with a struct
device_link?I wasn't aware of
device_linkconcept. This is something that I will keep in my mind when I'm dealing with producer/consumer problems with known device driver instances. It looked very useful.Here is how the overall relationship between drivers.
| GED | <---> | Platform specific ACPI AML | <----> Vendor GPIO
<----> Vendor I2C <----> ACPI GHES <----> Some other driverThe problem with Generic Event Device (GED) is that it produces event notification facility to the platform specific AML code and GED doesn't have any idea about the consumers of these interrupts or what platform AML does.
GED only sees the interrupts that it needs to register and knows the ASL code it needs to execute when that interrupt happens.
It is possible for AML code not to use any of these drivers or require some arbitrary driver as well as vendor specific drivers. It is totally up to the firmware to decide what to do with this event.
My proposal was to require platform AML code to indicate the dependencies between GED and drivers on the right side of the picture via
_DEPas this cannot be done via normal kernel mechanisms.This approach might work in general. However, it also has its own caveats.
All of these drivers on the right side are unrelated to each other. Some operating system can implement a subset of these drivers.
If I include the dependencies, GED will never load for partial driver situations. This is also a deal breaker.
Why would you break some other feature if your OS doesn't support RAS as an example?
Quoted 7 lines
Given all these lose bindings and no driver association, where do we go from here?
I consider GED as a light version of Embedded controller (EC) implementation.
How is this problem solved for EC as it has the same problem?
This recommendation came from Timur. I wanted to see how everybody feels about it.
When GED driver makes an AML call and the driver on the right side of the picture is not present, GED driver gets an ACPI error return code.
GED driver can potentially reschedule the AML call to be retried in 30 seconds.
Repeat this 5 times. If nobody handles the event, disable the interrupt.
Let me know what you think.
Signature · 3 lines
Sinan Kaya 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.
Quoted 69 lines · Sinan Kaya
Quoted 68 lines · Sinan Kaya
Quoted 12 lines · Lukas Wunner
Quoted 11 lines · Sinan Kaya
Quoted 5 lines · Rafael J. Wysocki
+late_initcall(ged_init);
Does this fix the problem?What about if the module in question is loaded after running
late_initcalls?This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
Quoted 7 lines
Quoted 3 lines
However, I'm open to improvements. Do you have a better suggestion? I can try to add some
_DEPstuff if it is present, but I remember Linux doesn't like_DEPstuff too much.Would it be possible to solve this by just returning -EPROBE_DEFER from the ->probe hook if the devices you depend on are not bound yet?
I'm not sure.
Quoted 1 line
Alternatively, would it be possible to solve it with a struct
device_link?I wasn't aware of
device_linkconcept. This is something that I will keep in my mind when I'm dealing with producer/consumer problems with known device driver instances. It looked very useful.Here is how the overall relationship between drivers.
| GED | <---> | Platform specific ACPI AML | <----> Vendor GPIO
<----> Vendor I2C <----> ACPI GHES <----> Some other driverThe problem with Generic Event Device (GED) is that it produces event notification facility to the platform specific AML code and GED doesn't have any idea about the consumers of these interrupts or what platform AML does.
GED only sees the interrupts that it needs to register and knows the ASL code it needs to execute when that interrupt happens.
It is possible for AML code not to use any of these drivers or require some arbitrary driver as well as vendor specific drivers. It is totally up to the firmware to decide what to do with this event.
My proposal was to require platform AML code to indicate the dependencies between GED and drivers on the right side of the picture via
_DEPas this cannot be done via normal kernel mechanisms.This approach might work in general. However, it also has its own caveats.
All of these drivers on the right side are unrelated to each other. Some operating system can implement a subset of these drivers.
If I include the dependencies, GED will never load for partial driver situations. This is also a deal breaker.
Why would you break some other feature if your OS doesn't support RAS as an example?
Given all these lose bindings and no driver association, where do we go from here?
I consider GED as a light version of Embedded controller (EC) implementation.
Quoted 7 lines
Quoted 2 lines
How is this problem solved for EC as it has the same problem?
This recommendation came from Timur. I wanted to see how everybody feels about it.
When GED driver makes an AML call and the driver on the right side of the picture is not present, GED driver gets an ACPI error return code.
This means that _EVT evaluation failed, right?
How does the _EVT in question look like? What does make it depend on the other drivers to be present in particular?
Thanks,
Rafael
Quoted 6 lines · Rafael J. Wysocki
Quoted 2 lines
When GED driver makes an AML call and the driver on the right side of the picture is not present, GED driver gets an ACPI error return code.
This means that
_EVTevaluation failed, right?How does the
_EVTin question look like? What does make it depend on the other drivers to be present in particular?
This one was trying to use an I2C Operating Region. The QUP I2C driver was not loaded yet. Since the I2C namespace handler was not registered, ACPI returned an error.
[ 5.061989] ACPI Error: Result stack is empty! State=ffffe021fd9eac00 (20160930/dswstate-99)^M [ 5.061992] ACPI Error: Method parse/execution failed [\_SB.I1C2.ARBT.LCK] (Node ffffe0213c154988), AE_NOT_EXIST (20160930/psparse-543)^M [ 5.061998] ACPI Error: Method parse/execution failed [\_SB.I1C2.PDV0.GETI] (Node ffffe0213c154410), AE_NOT_EXIST (20160930/psparse-543)^M [ 5.062003] ACPI Error: Method parse/execution failed [\_SB.PHP0.GETI] (Node ffffe0213c135118), AE_NOT_EXIST (20160930/psparse-543)^M [ 5.062009] ACPI Error: Method parse/execution failed [\_SB.PHP0.PVNH] (Node ffffe0213c135dc0), AE_NOT_EXIST (20160930/psparse-543)^M [ 5.062013] ACPI Error: Method parse/execution failed [\_SB.PCI0.PEVN] (Node ffffe0213c133910), AE_NOT_EXIST (20160930/psparse-543)^M [ 5.062017] ACPI Error: Method parse/execution failed [\_SB.GED1.PCIM] (Node ffffe0213c121398), AE_NOT_EXIST (20160930/psparse-543)^M [ 5.062022] ACPI Error: Method parse/execution failed [\_SB.GED1._EVT] (Node ffffe0213c1217d0), AE_NOT_EXIST (20160930/psparse-543)^M
Signature · 3 lines
Sinan Kaya 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.
Sorry for the delay.
Quoted 44 lines · Sinan Kaya
Quoted 12 lines · Lukas Wunner
Quoted 11 lines · Sinan Kaya
Quoted 5 lines · Rafael J. Wysocki
+late_initcall(ged_init);
Does this fix the problem?What about if the module in question is loaded after running
late_initcalls?This fixed the issue for me where I had dependencies for QUP I2C driver and GHES drivers. Both of them are modules and get probed via normal module execution path.
Quoted 7 lines
Quoted 3 lines
However, I'm open to improvements. Do you have a better suggestion? I can try to add some
_DEPstuff if it is present, but I remember Linux doesn't like_DEPstuff too much.Would it be possible to solve this by just returning -EPROBE_DEFER from the ->probe hook if the devices you depend on are not bound yet?
I'm not sure.
Quoted 1 line
Alternatively, would it be possible to solve it with a struct
device_link?I wasn't aware of
device_linkconcept. This is something that I will keep in my mind when I'm dealing with producer/consumer problems with known device driver instances. It looked very useful.Here is how the overall relationship between drivers.
| GED | <---> | Platform specific ACPI AML | <----> Vendor GPIO
<----> Vendor I2C <----> ACPI GHES <----> Some other driverThe problem with Generic Event Device (GED) is that it produces event notification facility to the platform specific AML code and GED doesn't have any idea about the consumers of these interrupts or what platform AML does.
GED only sees the interrupts that it needs to register and knows the ASL code it needs to execute when that interrupt happens.
Quoted 7 lines
It is possible for AML code not to use any of these drivers or require some arbitrary driver as well as vendor specific drivers. It is totally up to the firmware to decide what to do with this event.
My proposal was to require platform AML code to indicate the dependencies between GED and drivers on the right side of the picture via
_DEPas this cannot be done via normal kernel mechanisms.
Something like _DEP would be needed.
However, _DEP as specified is only about operation region dependencies, which doesn't seem to be applicable here.
That said, _DEP is used for general dependecies by firmware already, but it would at least be good to send a proposal for a spec update regarding that before mandating using _DEP for GED.
Quoted 7 lines
This approach might work in general. However, it also has its own caveats.
All of these drivers on the right side are unrelated to each other. Some operating system can implement a subset of these drivers.
If I include the dependencies, GED will never load for partial driver situations. This is also a deal breaker.
_DEP doesn't mean a hard dependency AFAICS. It is about ordering, not about presence, at least as specified currently.
Quoted 7 lines
Why would you break some other feature if your OS doesn't support RAS as an example?
Given all these lose bindings and no driver association, where do we go from here?
I consider GED as a light version of Embedded controller (EC) implementation.
No, it is not.
It is more of a generalization of the GPE/SCI mechanism in order to make it possible to cover things different from GPIO (which already is covered by _AEI).
Quoted 1 line
How is this problem solved for EC as it has the same problem?
It doesn't. The EC relies on the GPE/SCI mechanism to be there and that is always present.
Thanks,
Rafael
Hi Rafael,
Quoted 11 lines · Rafael J. Wysocki
Quoted 3 lines
My proposal was to require platform AML code to indicate the dependencies between GED and drivers on the right side of the picture via
_DEPas this cannot be done via normal kernel mechanisms.Something like
_DEPwould be needed.However,
_DEPas specified is only about operation region dependencies, which doesn't seem to be applicable here.That said,
_DEPis used for general dependecies by firmware already, but it would at least be good to send a proposal for a spec update regarding that before mandating using_DEPfor GED.
OK. I'll reach out to Harb and let's see where the proposal goes.
Quoted 11 lines
Quoted 8 lines
This approach might work in general. However, it also has its own caveats.
All of these drivers on the right side are unrelated to each other. Some operating system can implement a subset of these drivers.
If I include the dependencies, GED will never load for partial driver situations. This is also a deal breaker.
_DEPdoesn't mean a hard dependency AFAICS. It is about ordering, not about presence, at least as specified currently.
Quoted 8 lines
Quoted 7 lines
Why would you break some other feature if your OS doesn't support RAS as an example?
Given all these lose bindings and no driver association, where do we go from here?
I consider GED as a light version of Embedded controller (EC) implementation.
No, it is not.
Thanks for correction. Let me repeat with the correct terminology this time.
Don't we have the same problem on GPE/SCI mechanism?
An event that SCI is delivering may not be handled because the handler of the event is not present during OS boot?
The SCI relationship would be:
| SCI | <---> | Platform specific ACPI AML (_AEI) | <----> Vendor XYZ driver
<----> Vendor I2C
<----> ACPI GHESQuoted 11 lines
It is more of a generalization of the GPE/SCI mechanism in order to make it possible to cover things different from GPIO (which already is covered by
_AEI).Quoted 1 line
How is this problem solved for EC as it has the same problem?
It doesn't. The EC relies on the GPE/SCI mechanism to be there and that is always present.
Thanks,
Rafael
Signature · 3 lines
Sinan Kaya 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.
Quoted 8 lines · Sinan Kaya
Hi Rafael,
Quoted 5 lines · Rafael J. Wysocki
Quoted 3 lines
My proposal was to require platform AML code to indicate the dependencies between GED and drivers on the right side of the picture via
_DEPas this cannot be done via normal kernel mechanisms.Something like
_DEPwould be needed.
Quoted 8 lines
Quoted 6 lines
However,
_DEPas specified is only about operation region dependencies, which doesn't seem to be applicable here.That said,
_DEPis used for general dependecies by firmware already, but it would at least be good to send a proposal for a spec update regarding that before mandating using_DEPfor GED.OK. I'll reach out to Harb and let's see where the proposal goes.
It looks like this is about operation regions after all, however, so _DEP as is should be sufficient here.
There is some limited _DEP support in the ACPI layer, but we were missing a way to represent those dependencies in the driver core.
That can be done through device_link objects now, so we may be able to support _DEP in a more meaningful way, but the cases when _DEP is used for something different from operation regions in practice need to be treated with caution.
Quoted 17 lines
Quoted 17 lines
Quoted 8 lines
This approach might work in general. However, it also has its own caveats.
All of these drivers on the right side are unrelated to each other. Some operating system can implement a subset of these drivers.
If I include the dependencies, GED will never load for partial driver situations. This is also a deal breaker.
_DEPdoesn't mean a hard dependency AFAICS. It is about ordering, not about presence, at least as specified currently.Quoted 6 lines
Why would you break some other feature if your OS doesn't support RAS as an example?
Given all these lose bindings and no driver association, where do we go from here?
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
I consider GED as a light version of Embedded controller (EC) implementation.
No, it is not.
Thanks for correction. Let me repeat with the correct terminology this time.
Don't we have the same problem on GPE/SCI mechanism?
Yes, in theory.
Quoted 2 lines
An event that SCI is delivering may not be handled because the handler of the event is not present during OS boot?
It would be a problem if something like _Lxx or _Exx referred to an operation region without a handler, but these usually refer to operation regions in memory or in the PCI config space and there are default operation region handlers for those address spaces.
Of course, if they referred to operation regions on an I2C bus, for example, the problem might very well occur in there too.
Quoted 6 lines
The SCI relationship would be:
| SCI | <---> | Platform specific ACPI AML (
_AEI) | <----> Vendor XYZ driver<----> Vendor I2C <----> ACPI GHES
This would not be the SCI AFAICS, because _AEI is specific to GPIO interrupts and it only says which interrupts should be handled by the ACPI layer. There needs to be _EVT for handling them just like in the GED case (or the other way around, actuallly), so this is just analogous to GED.
Thanks,
Rafael
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line
OK. I'll reach out to Harb and let's see where the proposal goes.
It looks like this is about operation regions after all, however, so
_DEPas is should be sufficient here.
Quoted 8 lines
There is some limited
_DEPsupport in the ACPI layer, but we were missing a way to represent those dependencies in the driver core.That can be done through
device_linkobjects now, so we may be able to support_DEPin a more meaningful way, but the cases when_DEPis used for something different from operation regions in practice need to be treated with caution.
_DEP could certainly help here. However, _DEP doesn't answer the loose binding question. If one driver is missing in one operating system, _GED driver will never load due to unsatisfied dependency. This forces us into all or none condition. We have operating systems that we need to support and do not have vendor I2C or GPIO drivers. That's why, we are hesitant to place _DEP into ACPI tables.
The problem is that there is no concept of per event dependency. This could have helped us figure out if such an interrupt should be enabled or not.
Another solution for operating regions is _REG if FW wants to ignore the event during boot. This is the one we are looking into at this moment for non-critical events.
late_init proposed in this patch helps for built-in drivers such as GHES where we do not want to ignore events. Since GHES is not an actual device, this has to be solved in ACPI.
Sinan
Signature · 3 lines
Sinan Kaya 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.
Rafael J. Wysocki
maintainerQuoted 16 lines · Sinan Kaya
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line
OK. I'll reach out to Harb and let's see where the proposal goes.
It looks like this is about operation regions after all, however, so
_DEPas is should be sufficient here.Quoted 8 lines
There is some limited
_DEPsupport in the ACPI layer, but we were missing a way to represent those dependencies in the driver core.That can be done through
device_linkobjects now, so we may be able to support_DEPin a more meaningful way, but the cases when_DEPis used for something different from operation regions in practice need to be treated with caution.
Quoted 5 lines
_DEPcould certainly help here. However,_DEPdoesn't answer the loose binding question. If one driver is missing in one operating system,_GEDdriver will never load due to unsatisfied dependency. This forces us into all or none condition. We have operating systems that we need to support and do not have vendor I2C or GPIO drivers. That's why, we are hesitant to place_DEPinto ACPI tables.
_DEP as defined in the spec should be fine still.
Quoting directly:
"_DEP evaluates to a package and designates device objects that OSPM should assign a higher
priority in start ordering due to future operation region accesses.
To increase the likelihood that an SPB operation region handler is available when needed, OSPM
needs to know in advance which methods will access it -- _DEP provides OSPM with this
information. While the _DEP keyword may be used to determine start ordering, only the _REG
method (Section 6.5.4) callbacks can be relied upon to determine whether a region is accessible at a
given point in time."
So according to the above, _DEP is advisory only and you need _REG.
In theory, because I'm not sure if _REG actually works.
Quoted 9 lines
The problem is that there is no concept of per event dependency. This could have helped us figure out if such an interrupt should be enabled or not.
Another solution for operating regions is
_REGif FW wants to ignore the event during boot. This is the one we are looking into at this moment for non-critical events.
late_initproposed in this patch helps for built-in drivers such as GHES where we do not want to ignore events. Since GHES is not an actual device, this has to be solved in ACPI.
For built-in things it would be better to have explicit initialization ordering, eg. initializing both GHES and GED from one initcall in the right order.
Using different initcall levels for them is sort of OK, but then it is not quite clear from the code what the specific ordering requirement is, so please add a comment describing that at least.
Thanks,
Rafael
Hi Rafael,
Quoted 41 lines · Rafael J. Wysocki
Quoted 16 lines · Sinan Kaya
Hi Rafael,
Quoted 4 lines · Rafael J. Wysocki
Quoted 1 line
OK. I'll reach out to Harb and let's see where the proposal goes.
It looks like this is about operation regions after all, however, so
_DEPas is should be sufficient here.Quoted 8 lines
There is some limited
_DEPsupport in the ACPI layer, but we were missing a way to represent those dependencies in the driver core.That can be done through
device_linkobjects now, so we may be able to support_DEPin a more meaningful way, but the cases when_DEPis used for something different from operation regions in practice need to be treated with caution.Quoted 5 lines
_DEPcould certainly help here. However,_DEPdoesn't answer the loose binding question. If one driver is missing in one operating system,_GEDdriver will never load due to unsatisfied dependency. This forces us into all or none condition. We have operating systems that we need to support and do not have vendor I2C or GPIO drivers. That's why, we are hesitant to place_DEPinto ACPI tables.
_DEPas defined in the spec should be fine still.Quoting directly:
"
_DEPevaluates to a package and designates device objects that OSPM should assign a higher
priority in start ordering due to future operation region accesses.To increase the likelihood that an SPB operation region handler is available when needed, OSPM
needs to know in advance which methods will access it --_DEPprovides OSPM with this
information. While the_DEPkeyword may be used to determine start ordering, only the_REG
method (Section 6.5.4) callbacks can be relied upon to determine whether a region is accessible at a
given point in time."
Quoted 3 lines
So according to the above,
_DEPis advisory only and you need_REG.In theory, because I'm not sure if
_REGactually works.
I have been testing _REG this week. It seems to be working just fine. We are transitioning our FW to use _REG.
Our experience with _DEP in other operating systems is a hard dependency rather than a soft dependency. We have observed some drivers not loading if the driver providing the dependency is not present at all. That's why, I have been taking my time evaluating this.
Quoted 11 lines
Quoted 10 lines
The problem is that there is no concept of per event dependency. This could have helped us figure out if such an interrupt should be enabled or not.
Another solution for operating regions is
_REGif FW wants to ignore the event during boot. This is the one we are looking into at this moment for non-critical events.
late_initproposed in this patch helps for built-in drivers such as GHES where we do not want to ignore events. Since GHES is not an actual device, this has to be solved in ACPI.
Quoted 7 lines
For built-in things it would be better to have explicit initialization ordering, eg. initializing both GHES and GED from one initcall in the right order.
Using different initcall levels for them is sort of OK, but then it is not quite clear from the code what the specific ordering requirement is, so please add a comment describing that at least.
We are doing two things in this front. The first thing is to change GHES so that the events that happen before boot are handled properly. Tyler Baicar has a patch for this. This is the right fix.
The second one is this patch. This one is more of a general solution. We can live without this patch if Tyler's patch is included at this moment.
This one is to prevent future problems. I can certainly move the init function around. Maybe, have one acpi_driver_init that calls ghes_init() followed by ged_init().
Please let me know your preference.
Quoted 4 lines
Thanks,
Rafael
Signature · 3 lines
Sinan Kaya 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.
Quoted 5 lines
My point is that nothing guarantees a specific ordering or timing of module loading in general, so moving stuff to different initcall levels does not really help 100% of the time.
Are you talking about init vs. probe in general?
Sorry, I'm trying to decode what you mean to see if there is some other behavior that I'm not aware of in ACPI.
Signature · 3 lines
Sinan Kaya 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.
Rafael J. Wysocki
maintainerQuoted 7 lines · Sinan Kaya
Quoted 5 lines
My point is that nothing guarantees a specific ordering or timing of module loading in general, so moving stuff to different initcall levels does not really help 100% of the time.
Are you talking about init vs. probe in general?
Yes.
Generally speaking, if the initialization of built-in code depends on a loadable module to be present, it has to explicitly wait for that module to advertise itself, this way or another, or it has to poll.
Quoted 2 lines
Sorry, I'm trying to decode what you mean to see if there is some other behavior that I'm not aware of in ACPI.
Sorry for being unclear.
Thanks,
Rafael
Quoted 10 lines · Rafael J. Wysocki
Quoted 1 line
Are you talking about init vs. probe in general?
Yes.
Generally speaking, if the initialization of built-in code depends on a loadable module to be present, it has to explicitly wait for that module to advertise itself, this way or another, or it has to poll.
Quoted 2 lines
Sorry, I'm trying to decode what you mean to see if there is some other behavior that I'm not aware of in ACPI.
Sorry for being unclear.
Just replied to Lukas. I think I have a question to you about the embedded controller implementation. Can you check that out?
Signature · 3 lines
Sinan Kaya 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.
Quoted 7 lines · Sinan Kaya
GED driver is currently set up as a platform driver. On modern operating systems, most of the drivers are compiled as kernel modules. It is possible that a GED interrupt event is received and the driver such as GHES/GPIO/I2C to service it is not available yet. To accommodate this use case, delay GED driver load to the late init phase.
Signed-off-by Sinan Kaya <[email protected]>
This resolves the GHES issue described here: https://lkml.org/lkml/2017/3/28/1083
Thanks,
Tyler
Quoted 20 lines
--- drivers/acpi/evged.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/acpi/evged.c +7
-1@@ -151,4 +151,10 @@ static int ged_probe(struct platform_device *pdev) .acpi_match_table = ACPI_PTR(ged_acpi_ids), }, }; -builtin_platform_driver (ged_driver); + +static __init int ged_init (void ) +{ +return platform_driver_register (&ged_driver); +} + +late_initcall (ged_init);
Signature · 3 lines
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.