public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	linux-i2c@vger.kernel.org, Sanket.Goswami@amd.com
Subject: Re: [PATCH v3 3/5] i2c: piix4: Add ACPI support for ASF SMBus device
Date: Sat, 7 Sep 2024 00:21:26 +0530	[thread overview]
Message-ID: <6a671a3b-d3fc-4a96-acf0-4c12a813fd1e@amd.com> (raw)
In-Reply-To: <Ztsn8ZqWjY1P3qws@smile.fi.intel.com>



On 9/6/2024 21:34, Andy Shevchenko wrote:
> On Fri, Sep 06, 2024 at 08:41:19PM +0530, Shyam Sundar S K wrote:
>> On 9/6/2024 20:10, Andy Shevchenko wrote:
>>> On Fri, Sep 06, 2024 at 06:50:48PM +0530, Shyam Sundar S K wrote:
>>>> On 9/6/2024 17:54, Andy Shevchenko wrote:
>>>>> On Fri, Sep 06, 2024 at 12:41:59PM +0530, Shyam Sundar S K wrote:
> 
> ...
> 
>>>>>> The AMD ASF controller is presented to the operating system as an ACPI
>>>>>> device. The piix4 driver can obtain the ASF handle through ACPI to
>>>>>> retrieve information about the ASF controller's attributes, such as the
>>>>>> ASF address space and interrupt number, and to handle ASF interrupts.
>>>>>
>>>>> Can you share an excerpt of DSDT to see how it looks like?
>>>>
>>>> Device (ASFC)
>>>> {
>>>> 	...
>>>
>>> Can you put the necessary bits for the enumeration (you may replace some IDs if
>>> they are not public yet to something like XX..XX or xx..xx)?
>>
>> Name (_HID, "AMDIXXXX")  // _HID: Hardware ID
>> Name (_UID, Zero)  // _UID: Unique ID
> 
> Thank you!
> 
> Now a question, why your case can't have a separate (platform) device driver?

I evaluated this approach before proposing the change, considering the
option of creating a separate platform driver, which is relatively
easier to implement.

However, there are a couple of important points to note:

- ASF is a subset of SMBus. If a system has 3 SMBus ports, this change
would allow one of the ports to handle ASF operations.

- In the current i2c_piix4 driver, the assumption is that the port
address 0xb20 is designated for auxiliary operations, but this same
port can also be used for ASF. This could lead to a scenario of port
collision. I tried to highlight this in the commit message, and you
can see some dance in piix4_probe().

- As a result, users might encounter an error on platforms that
support ASF: "SMBus region 0x%x already in use!"

This is why I believe it would be more meaningful to integrate the ASF
changes into the SMBus driver.

Thoughts..?

Thanks,
Shyam

> 
>>>>     Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
>>>>     {
>>>>         Name (ASBB, ResourceTemplate ()
>>>>         {
>>>>             Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, )
>>>>             {
>>>>                 0x00000014,
>>>>             }
>>>>             IO (Decode16,
>>>>                 0x0B20,             // Range Minimum
>>>>                 0x0B20,             // Range Maximum
>>>
>>> Typo in value? Shouldn't this be 0x0b3f?
>>
>> Its is 0xb20, that is meant for ASF.
> 
> Yes, I mixed up IO() vs. Memory*() resource. The IO() has two values for
> the start address and you fixed that to the above mentioned value.
> 
> TL;DR: this looks okay.
> 
>>>>                 0x00,               // Alignment
>>>>                 0x20,               // Length
>>>>                 )
>>>>             Memory32Fixed (ReadWrite,
>>>>                 0xFEC00040,         // Address Base
>>>>                 0x00000100,         // Address Length
>>>>                 )
>>>>         })
>>>>         Return (ASBB) /* \_SB_.ASFC._CRS.ASBB */
>>>>     }
>>>> 	...
>>>> }
> 
> ...
> 
>>>>>> +	status = acpi_get_handle(NULL, SB800_ASF_ACPI_PATH, &handle);
>>>>>> +	if (ACPI_FAILURE(status))
>>>>>> +		return -ENODEV;
>>>>>> +
>>>>>> +	adev = acpi_fetch_acpi_dev(handle);
>>>>>> +	if (!adev)
>>>>>> +		return -ENODEV;
>>>>>
>>>>> This approach I don't like. I would like to see DSDT for that
>>>>> as I mentioned above.
>>>>
>>>> I have posted the DSDT. Can you please elaborate your remarks?
>>>
>>> Not that parts that affect this...
>>
>> Alright, I have posted the _HID enumeration details above. Please let
>> me know if using acpi_fetch_acpi_dev() is acceptable or if there's a
>> better alternative.
> 
>> I am open to making changes based on these clarifications.
> 
> Since you have a proper Device object in ACPI, it seems to me that you should
> do other way around, i.e. having a platform device driver for this ACPI device
> (based on _HID) and use piix4 as a library for it.
> 

  reply	other threads:[~2024-09-06 18:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06  7:11 [PATCH v3 0/5] Introduce AMD ASF Controller Support to the i2c-piix4 driver Shyam Sundar S K
2024-09-06  7:11 ` [PATCH v3 1/5] i2c: piix4: Allow more than two algo selection for SMBus Shyam Sundar S K
2024-09-06  7:11 ` [PATCH v3 2/5] i2c: piix4: Add i2c_algorithm operations to support AMD ASF with SMBus Shyam Sundar S K
2024-09-06  7:11 ` [PATCH v3 3/5] i2c: piix4: Add ACPI support for ASF SMBus device Shyam Sundar S K
2024-09-06 12:24   ` Andy Shevchenko
2024-09-06 13:20     ` Shyam Sundar S K
2024-09-06 14:40       ` Andy Shevchenko
2024-09-06 15:11         ` Shyam Sundar S K
2024-09-06 16:04           ` Andy Shevchenko
2024-09-06 18:51             ` Shyam Sundar S K [this message]
2024-09-11 11:58               ` Shyam Sundar S K
2024-09-07  2:49   ` kernel test robot
2024-09-06  7:12 ` [PATCH v3 4/5] i2c: piix4: Adjust the SMBus debug message Shyam Sundar S K
2024-09-06  7:12 ` [PATCH v3 5/5] i2c: piix4: Clear remote IRR bit to get successive interrupt Shyam Sundar S K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6a671a3b-d3fc-4a96-acf0-4c12a813fd1e@amd.com \
    --to=shyam-sundar.s-k@amd.com \
    --cc=Sanket.Goswami@amd.com \
    --cc=andi.shyti@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-i2c@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox