platform/x86/dell: add buffer allocation/free functions for SMI calls
authorJuergen Gross <jgross@suse.com>
Fri, 18 Mar 2022 15:09:50 +0000 (16:09 +0100)
committerHans de Goede <hdegoede@redhat.com>
Wed, 27 Apr 2022 19:45:28 +0000 (21:45 +0200)
commit77089467fc799e2c24cb4067b013db9b7664f5ed
tree17bf9431e8ca566b38cf731675fb31c68da0734c
parent242e85a7a0a0994072383b5d29f017f6a17af472
platform/x86/dell: add buffer allocation/free functions for SMI calls

The dcdbas driver is used to call SMI handlers for both, dcdbas and
dell-smbios-smm. Both drivers allocate a buffer for communicating
with the SMI handler. The physical buffer address is then passed to
the called SMI handler via %ebx.

Unfortunately this doesn't work when running in Xen dom0, as the
physical address obtained via virt_to_phys() is only a guest physical
address, and not a machine physical address as needed by SMI.

The problem in dcdbas is easy to correct, as dcdbas is using
dma_alloc_coherent() for allocating the buffer, and the machine
physical address is available via the DMA address returned in the DMA
handle.

In order to avoid duplicating the buffer allocation code in
dell-smbios-smm, add a generic buffer allocation function to dcdbas
and use it for both drivers. This is especially fine regarding driver
dependencies, as dell-smbios-smm is already calling dcdbas to generate
the SMI request.

Signed-off-by: Juergen Gross <jgross@suse.com>
Link: https://lore.kernel.org/r/20220318150950.16843-1-jgross@suse.com
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/dell/dcdbas.c
drivers/platform/x86/dell/dcdbas.h
drivers/platform/x86/dell/dell-smbios-smm.c