diff mbox series

[02/18] ACPICA: Export acpi_ut_verify_cdat_checksum()

Message ID 167571657859.587790.12435839081602248140.stgit@djiang5-mobl3.local (mailing list archive)
State Handled Elsewhere
Headers show
Series cxl: Add support for QTG ID retrieval for CXL subsystem | expand

Commit Message

Dave Jiang Feb. 6, 2023, 8:49 p.m. UTC
Export the CDAT checksum verify function so CXL driver can use it to verify
CDAT coming from the CXL devices.

Given that this function isn't actually being used by ACPI internals,
removing the define check of APCI_CHECKSUM_ABORT so the function would
return failure on checksum fail since the driver will need to know.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
 drivers/acpi/acpica/utcksum.c |    4 +---
 include/linux/acpi.h          |    7 +++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

Comments

Rafael J. Wysocki Feb. 7, 2023, 2:19 p.m. UTC | #1
On Mon, Feb 6, 2023 at 9:49 PM Dave Jiang <dave.jiang@intel.com> wrote:
>
> Export the CDAT checksum verify function so CXL driver can use it to verify
> CDAT coming from the CXL devices.
>
> Given that this function isn't actually being used by ACPI internals,
> removing the define check of APCI_CHECKSUM_ABORT so the function would
> return failure on checksum fail since the driver will need to know.

If you want to make ACPICA changes, please first submit a pull request
to the upstream ACPICA project on GitHub.

Having done that, please resubmit the corresponding Linux patch with a
Link tag pointing to the upstream PR.

Thanks!

> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/acpi/acpica/utcksum.c |    4 +---
>  include/linux/acpi.h          |    7 +++++++
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/acpica/utcksum.c b/drivers/acpi/acpica/utcksum.c
> index c166e4c05ab6..c0f98c8f9a0b 100644
> --- a/drivers/acpi/acpica/utcksum.c
> +++ b/drivers/acpi/acpica/utcksum.c
> @@ -102,15 +102,13 @@ acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length)
>                                    "should be 0x%2.2X",
>                                    acpi_gbl_CDAT, cdat_table->checksum,
>                                    checksum));
> -
> -#if (ACPI_CHECKSUM_ABORT)
>                 return (AE_BAD_CHECKSUM);
> -#endif
>         }
>
>         cdat_table->checksum = checksum;
>         return (AE_OK);
>  }
> +EXPORT_SYMBOL_GPL(acpi_ut_verify_cdat_checksum);
>
>  /*******************************************************************************
>   *
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 5e6a876e17ba..09b44afef7df 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -1504,9 +1504,16 @@ static inline void acpi_init_ffh(void) { }
>  #ifdef CONFIG_ACPI
>  extern void acpi_device_notify(struct device *dev);
>  extern void acpi_device_notify_remove(struct device *dev);
> +extern acpi_status
> +acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length);
>  #else
>  static inline void acpi_device_notify(struct device *dev) { }
>  static inline void acpi_device_notify_remove(struct device *dev) { }
> +static inline acpi_status
> +acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length)
> +{
> +       return (AE_NOT_CONFIGURED);
> +}
>  #endif
>
>  #endif /*_LINUX_ACPI_H*/
>
>
Dave Jiang Feb. 7, 2023, 3:47 p.m. UTC | #2
On 2/7/23 7:19 AM, Rafael J. Wysocki wrote:
> On Mon, Feb 6, 2023 at 9:49 PM Dave Jiang <dave.jiang@intel.com> wrote:
>>
>> Export the CDAT checksum verify function so CXL driver can use it to verify
>> CDAT coming from the CXL devices.
>>
>> Given that this function isn't actually being used by ACPI internals,
>> removing the define check of APCI_CHECKSUM_ABORT so the function would
>> return failure on checksum fail since the driver will need to know.
> 
> If you want to make ACPICA changes, please first submit a pull request
> to the upstream ACPICA project on GitHub.
> 
> Having done that, please resubmit the corresponding Linux patch with a
> Link tag pointing to the upstream PR.

Ok will do. Thanks!
> 
> Thanks!
> 
>> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>> ---
>>   drivers/acpi/acpica/utcksum.c |    4 +---
>>   include/linux/acpi.h          |    7 +++++++
>>   2 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/acpi/acpica/utcksum.c b/drivers/acpi/acpica/utcksum.c
>> index c166e4c05ab6..c0f98c8f9a0b 100644
>> --- a/drivers/acpi/acpica/utcksum.c
>> +++ b/drivers/acpi/acpica/utcksum.c
>> @@ -102,15 +102,13 @@ acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length)
>>                                     "should be 0x%2.2X",
>>                                     acpi_gbl_CDAT, cdat_table->checksum,
>>                                     checksum));
>> -
>> -#if (ACPI_CHECKSUM_ABORT)
>>                  return (AE_BAD_CHECKSUM);
>> -#endif
>>          }
>>
>>          cdat_table->checksum = checksum;
>>          return (AE_OK);
>>   }
>> +EXPORT_SYMBOL_GPL(acpi_ut_verify_cdat_checksum);
>>
>>   /*******************************************************************************
>>    *
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index 5e6a876e17ba..09b44afef7df 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -1504,9 +1504,16 @@ static inline void acpi_init_ffh(void) { }
>>   #ifdef CONFIG_ACPI
>>   extern void acpi_device_notify(struct device *dev);
>>   extern void acpi_device_notify_remove(struct device *dev);
>> +extern acpi_status
>> +acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length);
>>   #else
>>   static inline void acpi_device_notify(struct device *dev) { }
>>   static inline void acpi_device_notify_remove(struct device *dev) { }
>> +static inline acpi_status
>> +acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length)
>> +{
>> +       return (AE_NOT_CONFIGURED);
>> +}
>>   #endif
>>
>>   #endif /*_LINUX_ACPI_H*/
>>
>>
Jonathan Cameron Feb. 9, 2023, 11:30 a.m. UTC | #3
On Tue, 7 Feb 2023 08:47:58 -0700
Dave Jiang <dave.jiang@intel.com> wrote:

> On 2/7/23 7:19 AM, Rafael J. Wysocki wrote:
> > On Mon, Feb 6, 2023 at 9:49 PM Dave Jiang <dave.jiang@intel.com> wrote:  
> >>
> >> Export the CDAT checksum verify function so CXL driver can use it to verify
> >> CDAT coming from the CXL devices.
> >>
> >> Given that this function isn't actually being used by ACPI internals,
> >> removing the define check of APCI_CHECKSUM_ABORT so the function would
> >> return failure on checksum fail since the driver will need to know.  

Seems unlikely this won't cause problems in usage of
AcpiUtVerifyCdatChecksum in the upstream ACPICA code.  So you may need
to leave that alone.

You will probably want a linux wrapper to export rather than
the acpica function.  That should let you avoid an acpica change I think.
There are no exports from within acpica code.

Jonathan


> > 
> > If you want to make ACPICA changes, please first submit a pull request
> > to the upstream ACPICA project on GitHub.
> > 
> > Having done that, please resubmit the corresponding Linux patch with a
> > Link tag pointing to the upstream PR.  
> 
> Ok will do. Thanks!
> > 
> > Thanks!
> >   
> >> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> >> ---
> >>   drivers/acpi/acpica/utcksum.c |    4 +---
> >>   include/linux/acpi.h          |    7 +++++++
> >>   2 files changed, 8 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/acpi/acpica/utcksum.c b/drivers/acpi/acpica/utcksum.c
> >> index c166e4c05ab6..c0f98c8f9a0b 100644
> >> --- a/drivers/acpi/acpica/utcksum.c
> >> +++ b/drivers/acpi/acpica/utcksum.c
> >> @@ -102,15 +102,13 @@ acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length)
> >>                                     "should be 0x%2.2X",
> >>                                     acpi_gbl_CDAT, cdat_table->checksum,
> >>                                     checksum));
> >> -
> >> -#if (ACPI_CHECKSUM_ABORT)
> >>                  return (AE_BAD_CHECKSUM);
> >> -#endif
> >>          }
> >>
> >>          cdat_table->checksum = checksum;
> >>          return (AE_OK);
> >>   }
> >> +EXPORT_SYMBOL_GPL(acpi_ut_verify_cdat_checksum);
> >>
> >>   /*******************************************************************************
> >>    *
> >> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> >> index 5e6a876e17ba..09b44afef7df 100644
> >> --- a/include/linux/acpi.h
> >> +++ b/include/linux/acpi.h
> >> @@ -1504,9 +1504,16 @@ static inline void acpi_init_ffh(void) { }
> >>   #ifdef CONFIG_ACPI
> >>   extern void acpi_device_notify(struct device *dev);
> >>   extern void acpi_device_notify_remove(struct device *dev);
> >> +extern acpi_status
> >> +acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length);
> >>   #else
> >>   static inline void acpi_device_notify(struct device *dev) { }
> >>   static inline void acpi_device_notify_remove(struct device *dev) { }
> >> +static inline acpi_status
> >> +acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length)
> >> +{
> >> +       return (AE_NOT_CONFIGURED);
> >> +}
> >>   #endif
> >>
> >>   #endif /*_LINUX_ACPI_H*/
> >>
> >>
diff mbox series

Patch

diff --git a/drivers/acpi/acpica/utcksum.c b/drivers/acpi/acpica/utcksum.c
index c166e4c05ab6..c0f98c8f9a0b 100644
--- a/drivers/acpi/acpica/utcksum.c
+++ b/drivers/acpi/acpica/utcksum.c
@@ -102,15 +102,13 @@  acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length)
 				   "should be 0x%2.2X",
 				   acpi_gbl_CDAT, cdat_table->checksum,
 				   checksum));
-
-#if (ACPI_CHECKSUM_ABORT)
 		return (AE_BAD_CHECKSUM);
-#endif
 	}
 
 	cdat_table->checksum = checksum;
 	return (AE_OK);
 }
+EXPORT_SYMBOL_GPL(acpi_ut_verify_cdat_checksum);
 
 /*******************************************************************************
  *
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 5e6a876e17ba..09b44afef7df 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1504,9 +1504,16 @@  static inline void acpi_init_ffh(void) { }
 #ifdef CONFIG_ACPI
 extern void acpi_device_notify(struct device *dev);
 extern void acpi_device_notify_remove(struct device *dev);
+extern acpi_status
+acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length);
 #else
 static inline void acpi_device_notify(struct device *dev) { }
 static inline void acpi_device_notify_remove(struct device *dev) { }
+static inline acpi_status
+acpi_ut_verify_cdat_checksum(struct acpi_table_cdat *cdat_table, u32 length)
+{
+	return (AE_NOT_CONFIGURED);
+}
 #endif
 
 #endif	/*_LINUX_ACPI_H*/