ACPI: New helper function acpi_dev_get_memory_resources() and a new ACPI ID
Subsystems (5)
Heikki Krogerus
maintainercover ACPI: New helper function acpi_dev_get_memory_resources() and a new ACPI ID
Hi,
The helper function returns all memory resources described for a device regardless of the ACPI descriptor type (as long as it's memory), but the first patch introduces new ACPI ID for the IOM controller on Intel Meteor Lake and also separately modifies the driver so that it can get the memory resource from Address Space Resource Descriptor.
An alternative would have been to introduce that helper function first so we would not need to modify the driver when the new ID is added, but then the helper would also need to be applied to the stable kernel releases, and that does not feel necessary or appropriate in this case, at least not IMO.
So that's why I'm proposing here that we first add the ID, and only after that introduce the helper, and only for mainline. That way the patch introducing the ID is the only that goes to the stable releases.
If that's okay, and these don't have any other problems, I assume it's OK if Rafael takes all of these, including the ID?
thanks,
Heikki Krogerus (5):
ACPI: resource: Filter out the non memory resources in is_memory()
ACPI: resource: Add helper function acpi_dev_get_memory_resources()
ACPI: APD: Use the helper acpi_dev_get_memory_resources()
ACPI: LPSS: Use the helper acpi_dev_get_memory_resources()
usb: typec: intel_pmc_mux: Use the helper
acpi_dev_get_memory_resources()
Utkarsh Patel (1):
usb: typec: intel_pmc_mux: Add new ACPI ID for Meteor Lake IOM device
drivers/acpi/acpi_apd.c | 9 +-------- drivers/acpi/acpi_lpss.c | 9 +-------- drivers/acpi/resource.c | 20 ++++++++++++++++++++ drivers/usb/typec/mux/intel_pmc_mux.c | 12 ++++-------- include/linux/acpi.h | 1 + 5 files changed, 27 insertions(+), 24 deletions(-)
Signature · 1 line
2.35.1
Heikki Krogerus
maintainerPATCH 1/6 usb: typec: intel_pmc_mux: Add new ACPI ID for Meteor Lake IOM device
From: Utkarsh Patel <[email protected]>
This adds the necessary ACPI ID for Intel Meteor Lake IOM devices.
The callback function is_memory() is modified so that it also checks if the resource descriptor passed to it is a memory type "Address Space Resource Descriptor".
On Intel Meteor Lake the ACPI memory resource is not described using the "32-bit Memory Range Descriptor" because the memory is outside of the 32-bit address space. The memory resource is described using the "Address Space Resource Descriptor" instead.
Intel Meteor Lake is the first platform to describe the memory resource for this device with Address Space Resource Descriptor, but it most likely will not be the last. Therefore the change to the is_memory() callback function is made generic.
--- drivers/usb/typec/mux/intel_pmc_mux.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +7 -2
@@ -571,9 +571,11 @@ static int pmc_usb_register_port(struct pmc_usb *pmc, int index,static int is_memory (struct acpi_resource *res,void *data) { -struct resource r; +struct resource_win win = {}; +struct resource *r = &win.res; -return !acpi_dev_resource_memory (res, &r); +return !(acpi_dev_resource_memory (res, r) || +acpi_dev_resource_address_space (res, &win)); }/* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */
@@ -583,6 +585,9 @@ static const struct acpi_device_id iom_acpi_ids[] = {/* AlderLake */ { "INTC1079", 0x160, }, + + /* Meteor Lake */ + { "INTC107A", 0x160, }, {} };
Signature · 1 line
2.35.1
Heikki Krogerus
maintainerPATCH 2/6 ACPI: resource: Filter out the non memory resources in is_memory()
In reply to Heikki KrogerusThis will generalise the function so it should become useful in more places.
--- drivers/acpi/resource.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/resource.c +3 -0
@@ -690,6 +690,9 @@ static int is_memory(struct acpi_resource *ares, void *not_used)memset (&win,0 ,sizeof (win)); +if (acpi_dev_filter_resource_type (ares,IORESOURCE_MEM )) +return 1 ; +return !(acpi_dev_resource_memory (ares, res) ||acpi_dev_resource_address_space (ares, &win) ||acpi_dev_resource_ext_address_space (ares, &win));
Signature · 1 line
2.35.1
Heikki Krogerus
maintainerPATCH 3/6 ACPI: resource: Add helper function acpi_dev_get_memory_resources()
In reply to Heikki KrogerusWrapper function that finds all memory type resources by using acpi_dev_get_resources(). It removes the need for the drivers to check the resource data type separately.
--- drivers/acpi/resource.c | 17 +++++++++++++++++ include/linux/acpi.h | 1 + 2 files changed, 18 insertions(+)
drivers/acpi/resource.c +17 -0
@@ -721,6 +721,23 @@ int acpi_dev_get_dma_resources(struct acpi_device *adev, struct list_head *list) }EXPORT_SYMBOL_GPL (acpi_dev_get_dma_resources); +/** +* acpi_dev_get_memory_resources - Get current memory resources of a device. +* @adev: ACPI device node to get the resources for. +* @list: Head of the resultant list of resources (must be empty). +* +* This is a helper function that locates all memory type resources of @adev +* with acpi_dev_get_resources(). +* +* The number of resources in the output list is returned on success, an error +* code reflecting the error condition is returned otherwise. +*/ +int acpi_dev_get_memory_resources (struct acpi_device *adev,struct list_head *list) +{ +return acpi_dev_get_resources (adev, list, is_memory,NULL ); +} +EXPORT_SYMBOL_GPL (acpi_dev_get_memory_resources); +/** * acpi_dev_filter_resource_type - Filter ACPI resource according to resource * types
include/linux/acpi.h +1 -0
@@ -506,6 +506,7 @@ int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, void *preproc_data);int acpi_dev_get_dma_resources (struct acpi_device *adev,struct list_head *list); +int acpi_dev_get_memory_resources (struct acpi_device *adev,struct list_head *list);int acpi_dev_filter_resource_type (struct acpi_resource *ares,unsigned long types);
Signature · 1 line
2.35.1
Heikki Krogerus
maintainerPATCH 4/6 ACPI: APD: Use the helper acpi_dev_get_memory_resources()
In reply to Heikki KrogerusIt removes the need to check the resource data type separately.
--- drivers/acpi/acpi_apd.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/acpi/acpi_apd.c +1 -8
@@ -60,12 +60,6 @@ static int acpi_apd_setup(struct apd_private_data *pdata) }#ifdef CONFIG_X86_AMD_PLATFORM_DEVICE -static int misc_check_res (struct acpi_resource *ares,void *data) -{ -struct resource res; - -return !acpi_dev_resource_memory (ares, &res); -}static int fch_misc_setup (struct apd_private_data *pdata) {
@@ -82,8 +76,7 @@ static int fch_misc_setup(struct apd_private_data *pdata)return -ENOMEM ;INIT_LIST_HEAD (&resource_list); - ret =acpi_dev_get_resources (adev, &resource_list, misc_check_res, -NULL ); + ret =acpi_dev_get_memory_resources (adev, &resource_list);if (ret <0 )return -ENOENT ;
Signature · 1 line
2.35.1
Heikki Krogerus
maintainerPATCH 5/6 ACPI: LPSS: Use the helper acpi_dev_get_memory_resources()
In reply to Heikki KrogerusIt removes the need to check the resource data type separately.
--- drivers/acpi/acpi_lpss.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/acpi/acpi_lpss.c +1 -8
@@ -392,13 +392,6 @@ static const struct acpi_device_id acpi_lpss_device_ids[] = {#ifdef CONFIG_X86_INTEL_LPSS -static int is_memory (struct acpi_resource *res,void *not_used) -{ -struct resource r; - -return !acpi_dev_resource_memory (res, &r); -} -/* LPSS main clock device. */ static struct platform_device *lpss_clk_dev;
@@ -659,7 +652,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,return -ENOMEM ;INIT_LIST_HEAD (&resource_list); - ret =acpi_dev_get_resources (adev, &resource_list, is_memory,NULL ); + ret =acpi_dev_get_memory_resources (adev, &resource_list);if (ret <0 ) goto err_out;
Signature · 1 line
2.35.1
Heikki Krogerus
maintainerPATCH 6/6 usb: typec: intel_pmc_mux: Use the helper acpi_dev_get_memory_resources()
In reply to Heikki KrogerusIt removes the need to check the resource data type separately.
--- drivers/usb/typec/mux/intel_pmc_mux.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/usb/typec/mux/intel_pmc_mux.c +1 -10
@@ -569,15 +569,6 @@ static int pmc_usb_register_port(struct pmc_usb *pmc, int index,return ret; } -static int is_memory (struct acpi_resource *res,void *data) -{ -struct resource_win win = {}; -struct resource *r = &win.res; - -return !(acpi_dev_resource_memory (res, r) || -acpi_dev_resource_address_space (res, &win)); -} -/* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */ static const struct acpi_device_id iom_acpi_ids[] = {/* TigerLake */
@@ -611,7 +602,7 @@ static int pmc_usb_probe_iom(struct pmc_usb *pmc)return -ENODEV ;INIT_LIST_HEAD (&resource_list); - ret =acpi_dev_get_resources (adev, &resource_list, is_memory,NULL ); + ret =acpi_dev_get_memory_resources (adev, &resource_list);if (ret <0 )return ret;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerQuoted 15 lines · Heikki Krogerus
Hi,
The helper function returns all memory resources described for a device regardless of the ACPI descriptor type (as long as it's memory), but the first patch introduces new ACPI ID for the IOM controller on Intel Meteor Lake and also separately modifies the driver so that it can get the memory resource from Address Space Resource Descriptor.
An alternative would have been to introduce that helper function first so we would not need to modify the driver when the new ID is added, but then the helper would also need to be applied to the stable kernel releases, and that does not feel necessary or appropriate in this case, at least not IMO.
Quoted 6 lines
So that's why I'm proposing here that we first add the ID, and only after that introduce the helper, and only for mainline. That way the patch introducing the ID is the only that goes to the stable releases.
If that's okay, and these don't have any other problems, I assume it's OK if Rafael takes all of these, including the ID?
I took the id now, for 6.0-final as it seems to be totally independant of the other commits (otherwise you would not have tagged it for the stable tree.)
The remainder should probably be resent and send through the acpi tree.
thanks,
greg k-h
Heikki Krogerus
maintainerHi,
Quoted 20 lines · Greg Kroah-Hartman
Quoted 19 lines · Heikki Krogerus
Hi,
The helper function returns all memory resources described for a device regardless of the ACPI descriptor type (as long as it's memory), but the first patch introduces new ACPI ID for the IOM controller on Intel Meteor Lake and also separately modifies the driver so that it can get the memory resource from Address Space Resource Descriptor.
An alternative would have been to introduce that helper function first so we would not need to modify the driver when the new ID is added, but then the helper would also need to be applied to the stable kernel releases, and that does not feel necessary or appropriate in this case, at least not IMO.
So that's why I'm proposing here that we first add the ID, and only after that introduce the helper, and only for mainline. That way the patch introducing the ID is the only that goes to the stable releases.
Quoted 8 lines
Quoted 2 lines
If that's okay, and these don't have any other problems, I assume it's OK if Rafael takes all of these, including the ID?
I took the id now, for 6.0-final as it seems to be totally independant of the other commits (otherwise you would not have tagged it for the stable tree.)
The remainder should probably be resent and send through the acpi tree.
Okay. The last patch depends on that ID patch, so Rafael, you need to handle that conflict with immutable branch I guess. Or should we just skip that patch for now?
I think another way to handle this would be that Greg, you take the whole series.
thanks,
Signature · 1 line
heikki
Greg Kroah-Hartman
maintainerQuoted 30 lines · Heikki Krogerus
Hi,
Quoted 27 lines · Greg Kroah-Hartman
Quoted 15 lines · Heikki Krogerus
Hi,
The helper function returns all memory resources described for a device regardless of the ACPI descriptor type (as long as it's memory), but the first patch introduces new ACPI ID for the IOM controller on Intel Meteor Lake and also separately modifies the driver so that it can get the memory resource from Address Space Resource Descriptor.
An alternative would have been to introduce that helper function first so we would not need to modify the driver when the new ID is added, but then the helper would also need to be applied to the stable kernel releases, and that does not feel necessary or appropriate in this case, at least not IMO.
Quoted 6 lines
So that's why I'm proposing here that we first add the ID, and only after that introduce the helper, and only for mainline. That way the patch introducing the ID is the only that goes to the stable releases.
If that's okay, and these don't have any other problems, I assume it's OK if Rafael takes all of these, including the ID?
I took the id now, for 6.0-final as it seems to be totally independant of the other commits (otherwise you would not have tagged it for the stable tree.)
Quoted 5 lines
Quoted 1 line
The remainder should probably be resent and send through the acpi tree.
Okay. The last patch depends on that ID patch, so Rafael, you need to handle that conflict with immutable branch I guess. Or should we just skip that patch for now?
You can wait for -rc3 or so which should have that commit in it.
thanks,
greg k-h
Rafael J. Wysocki
maintainerQuoted 32 lines · Greg Kroah-Hartman
Quoted 30 lines · Heikki Krogerus
Hi,
Quoted 27 lines · Greg Kroah-Hartman
Quoted 15 lines · Heikki Krogerus
Hi,
The helper function returns all memory resources described for a device regardless of the ACPI descriptor type (as long as it's memory), but the first patch introduces new ACPI ID for the IOM controller on Intel Meteor Lake and also separately modifies the driver so that it can get the memory resource from Address Space Resource Descriptor.
An alternative would have been to introduce that helper function first so we would not need to modify the driver when the new ID is added, but then the helper would also need to be applied to the stable kernel releases, and that does not feel necessary or appropriate in this case, at least not IMO.
Quoted 6 lines
So that's why I'm proposing here that we first add the ID, and only after that introduce the helper, and only for mainline. That way the patch introducing the ID is the only that goes to the stable releases.
If that's okay, and these don't have any other problems, I assume it's OK if Rafael takes all of these, including the ID?
I took the id now, for 6.0-final as it seems to be totally independant of the other commits (otherwise you would not have tagged it for the stable tree.)
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
The remainder should probably be resent and send through the acpi tree.
Okay. The last patch depends on that ID patch, so Rafael, you need to handle that conflict with immutable branch I guess. Or should we just skip that patch for now?
You can wait for -rc3 or so which should have that commit in it.
I'll apply the series on top of -rc3.
Cheers!