lkml.org 
[lkml]   [2018]   [Jun]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v3] dcdbas: Add support for WSMT ACPI table
    From
    Date

    On 6/13/2018 3:54 AM, Andy Shevchenko wrote:
    >> + /* Calling Interface SMI
    >
    > I suppose the style of the comments like
    > /*
    > * Calling ...
    > ...

    Yes... goof on my part. Thanks.

    >> + *
    >> + * 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?
    >
    > (Also note () when referring to functions)
    >
    >> + */
    >> + smi_cmd->ebx = smi_data_buf_phys_addr +
    >> + offsetof(struct smi_cmd, command_buffer);
    >
    > Btw, can it be one line (~83 character are okay for my opinion).
    >

    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.

    But that would be like 97 characters long if I made it all one line...

    >> + acpi_get_table(ACPI_SIG_WSMT, 0, (struct acpi_table_header **)&wsmt);
    >> + if (!wsmt)
    >> + return 0;
    >> +
    >> + /* Check if WSMT ACPI table shows that protection is enabled */
    >> + if (!(wsmt->protection_flags & ACPI_WSMT_FIXED_COMM_BUFFERS)
    >
    >> + || !(wsmt->protection_flags
    >> + & ACPI_WSMT_COMM_BUFFER_NESTED_PTR_PROTECTION))
    >
    > Better to indent like
    >
    > if (... ||
    > !(... & ...)
    >

    Yes thanks.

    >> + 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 again for your time!

    \
     
     \ /
      Last update: 2018-06-14 16:23    [W:5.780 / U:1.136 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site