lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: 
 <CO6PR18MB40988BB723DB7576F5C25155B0E52@CO6PR18MB4098.namprd18.prod.outlook.com>
Date: Wed, 8 May 2024 08:04:49 +0000
From: Witold Sadowski <wsadowski@...vell.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-spi@...r.kernel.org" <linux-spi@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
CC: "broonie@...nel.org" <broonie@...nel.org>,
        "robh@...nel.org"
	<robh@...nel.org>,
        "krzysztof.kozlowski+dt@...aro.org"
	<krzysztof.kozlowski+dt@...aro.org>,
        "conor+dt@...nel.org"
	<conor+dt@...nel.org>,
        "pthombar@...ence.com" <pthombar@...ence.com>,
        Piyush
 Malgujar <pmalgujar@...vell.com>
Subject: RE: [EXTERNAL] Re: [PATCH v3 4/5] spi: cadence: Allow to read basic
 xSPI configuration from ACPI

 > On 29/04/2024 16:30, Witold Sadowski wrote:
> >>>
> >>> +#ifdef CONFIG_ACPI
> >>> +static const struct acpi_device_id cdns_xspi_acpi_match[] = {
> >>> +	{
> >>> +		.id = "cdns,xspi-nor",
> >>> +		.driver_data = (kernel_ulong_t) &cdns_driver_data,
> >>> +	},
> >>> +	{
> >>> +		.id = "mrvl,xspi-nor",
> >>> +		.driver_data = (kernel_ulong_t) &mrvl_driver_data,
> >>
> >> UEFI provides compatibles for ACPI? I think that's first such format
> >> in the kernel.
> >
> > Yes, that code is not doing what was expected.
> > Current usage scenario in ACPI mode is:
> > xSPI block with HID PRP0001, and additional compatible package set to
> > correct compatible string With that approach only issue(in ACPI mode)
> > is with matching device with data field from of_device_id. It looks
> > like there are functions to match that when DTB is used, but in ACPI
> > mode it fails.
> > I believe solution is to traverse dev->driver->of_match_table manually
> > To match device name with correct compatible data structure.
> > That will be included in next patchset.
> 
> PRP0001 should be handled by regular of_device_id table, of course
> assuming your kernel has build-in CONFIG_OF.

And it is correctly matched by id, but functions to retrieve data fails.
I'm referring to of_device_get_match_data - there is no of node in
ACPI case.

I have come up with solution, as I wasn't able to find similar function that
will work with ACPI and dtb on the same time:
static const void * cdns_xspi_get_data(struct device *dev)
{
	const struct of_device_id *matches = dev->driver->of_match_table;

	for (; matches->name[0] || matches->type[0] || matches->compatible[0]; 
             matches++) {
		if (device_is_compatible(dev, matches->compatible))
			return matches->data;
	}

	return NULL;
}

Is there a better way to handle that?

> 
> Best regards,
> Krzysztof



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ