public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stuart Hayes <stuart.w.hayes@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>,
	Douglas_Warzecha@dell.com,
	Mario Limonciello <mario.limonciello@dell.com>,
	Jared.Dominguez@dell.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Platform Driver <platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH v3] dcdbas: Add support for WSMT ACPI table
Date: Thu, 14 Jun 2018 17:31:08 -0500	[thread overview]
Message-ID: <b5652ed8-5fff-4f8b-ec0f-467bce853bf8@gmail.com> (raw)
In-Reply-To: <CAHp75VdTGXqE__VHjRphEmpMVfxaVVik=u-_0NRhQAKeq=+ZKA@mail.gmail.com>



On 6/14/2018 12:25 PM, Andy Shevchenko wrote:
> On Thu, Jun 14, 2018 at 5:22 PM, Stuart Hayes <stuart.w.hayes@gmail.com> wrote:
>> On 6/13/2018 3:54 AM, Andy Shevchenko wrote:
> 
>>>> +                * Provide physical address of command buffer field within
>>>> +                * the struct smi_cmd... can't use virt_to_phys on smi_cmd
>>>> +                * because address may be from memremap.
>>>
>>> Wait, memremap() might return a virtual address. How we be sure that
>>> we got still physical address here?
> 
>> Before this patch, the address in smi_cmd always came from an alloc, so
>> virt_to_phys() was used to get the physical address here.  With WSMT, we
>> could be using a BIOS-provided buffer for SMI, in which case the address in
>> smi_cmd will come from memremap(), so we can't use virt_to_phys() on it.
>> So instead I changed this to use the physical address of smi_data_buf that
>> is stored in smi_data_buf_phys_addr, which will be valid regardless of how
>> the address of smi_data_buf was generated.
> 
> Yes, but what does guarantee that memremap() will return you still
> physical address?
> 

Sorry, I'm not sure I understand the question.

Up to now, this driver always just allocated a buffer from main memory that
it used to send/receive information from BIOS when it generated a SMI.  That's
what smi_cmd points to where this comment is.  And it was safe to use
virt_to_phys() on this address.

With this patch, though, the driver may now be using a buffer that isn't part
of main memory--it could now be using a buffer that BIOS provided the physical
address for, and this would not be part of main memory.  So smi_cmd may contain
a virtual address that memremap() provided.  And because memremap() is just
like ioremap(), the driver can no longer use virt_to_phys(smi_cmd) to get the
physical address of the buffer.

My comment is just pointing that out... I was trying to say, "the code can't
use virt_to_phys(smi_cmd) to get the virtual address here".

memremap() should always return a virtual address that points to the physical
address we send it (unless it fails of course).


>>>> +               return 0;
>>>> +
>>>> +       /* Scan for EPS (entry point structure) */
>>>> +       for (addr = (u8 *)__va(0xf0000);
>>>> +            addr < (u8 *)__va(0x100000 - sizeof(struct smm_eps_table));
>>>
>>>> +            addr += 1) {
>>>
>>> This wasn't commented IIRC and changed. So, why?
> 
>> I changed this is response to your earlier comment (7 june)... you had pointed
>> out that it would be better if I put an "if (eps) break;" inside the for loop
>> instead of having "&& !eps" in the condition of the for loop.  I put the note
>> "Changed loop searching 0xf0000 to be more readable" in the list of changes for
>> patch version v3 to cover this change.
> 
> Thanks, but here I meant += 1 vs += 16 step.
> 

Sorry, I thought I had answered this earlier.  The spec does not say that the EPS
table will be on a 16-byte boundary.  And I just added a printk in this driver to
see where it is on the system I had at hand, and it isn't on a 16-byte boundary:

[ 4680.192542] dcdbas - EPS table at 000000005761efb7
[ 4680.194012] dcdbas dcdbas: WSMT found, using firmware-provided SMI buffer.
[ 4680.195327] dcdbas dcdbas: Dell Systems Management Base Driver (version 5.6.0-3.3)

  reply	other threads:[~2018-06-14 22:31 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-16 14:05 [PATCH v2] dcdbas: Add support for WSMT ACPI table Stuart Hayes
2018-05-25 19:01 ` Douglas.Warzecha
2018-05-28  5:20   ` Mario.Limonciello
2018-06-07 15:59 ` [PATCH resend " Stuart Hayes
2018-06-07 16:07   ` Mario.Limonciello
2018-06-08 23:08     ` Darren Hart
2018-06-07 17:11   ` Andy Shevchenko
2018-06-09  1:04     ` Darren Hart
2018-06-09 18:57       ` Andy Shevchenko
2018-06-13  1:24         ` [PATCH v3] " Stuart Hayes
2018-06-13  8:54           ` Andy Shevchenko
2018-06-14 14:22             ` Stuart Hayes
2018-06-14 17:25               ` Andy Shevchenko
2018-06-14 22:31                 ` Stuart Hayes [this message]
2018-06-27 23:52                   ` Andy Shevchenko
2018-06-29 18:56                     ` Stuart Hayes
2018-06-29 19:29                       ` Andy Shevchenko
2018-07-02 14:07                         ` Mario.Limonciello
2018-07-02 15:21                           ` Andy Shevchenko
2018-07-02 16:15                             ` Mario.Limonciello
2018-07-03 13:52                               ` Stuart Hayes
2018-07-03 16:20                               ` [PATCH v5] " Stuart Hayes
2018-07-13 14:34                                 ` Andy Shevchenko
2018-07-16 13:37                                   ` Mario.Limonciello
2018-06-14 15:45           ` [PATCH v4] " Stuart Hayes
2018-06-14 17:26             ` Andy Shevchenko
2018-06-26  3:12               ` Stuart Hayes
2018-06-11 13:47       ` [PATCH resend v2] " Mario.Limonciello
2018-06-11 14:30       ` Stuart Hayes

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=b5652ed8-5fff-4f8b-ec0f-467bce853bf8@gmail.com \
    --to=stuart.w.hayes@gmail.com \
    --cc=Douglas_Warzecha@dell.com \
    --cc=Jared.Dominguez@dell.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@dell.com \
    --cc=platform-driver-x86@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