Merge tag 'x86_apic_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 SEV and apic updates from Borislav Petkov:

 - Add functionality to provide runtime firmware updates for the non-x86
   parts of an AMD platform like the security processor (ASP) firmware,
   modules etc, for example. The intent being that these updates are
   interim, live fixups before a proper BIOS update can be attempted

 - Add guest support for AMD's Secure AVIC feature which gives encrypted
   guests the needed protection against a malicious hypervisor
   generating unexpected interrupts and injecting them into such guest,
   thus interfering with its operation in an unexpected and negative
   manner.

   The advantage of this scheme is that the guest determines which
   interrupts and when to accept them vs leaving that to the benevolence
   (or not) of the hypervisor

 - Strictly separate the startup code from the rest of the kernel where
   former is executed from the initial 1:1 mapping of memory.

   The problem was that the toolchain-generated version of the code was
   being executed from a different mapping of memory than what was
   "assumed" during code generation, needing an ever-growing pile of
   fixups for absolute memory references which are invalid in the early,
   1:1 memory mapping during boot.

   The major advantage of this is that there's no need to check the 1:1
   mapping portion of the code for absolute relocations anymore and get
   rid of the RIP_REL_REF() macro sprinkling all over the place.

   For more info, see Ard's very detailed writeup on this [1]

 - The usual cleanups and fixes

Link: https://lore.kernel.org/r/CAMj1kXEzKEuePEiHB%2BHxvfQbFz0sTiHdn4B%2B%2BzVBJ2mhkPkQ4Q@mail.gmail.com [1]

* tag 'x86_apic_for_v6.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (49 commits)
  x86/boot: Drop erroneous __init annotation from early_set_pages_state()
  crypto: ccp - Add AMD Seamless Firmware Servicing (SFS) driver
  crypto: ccp - Add new HV-Fixed page allocation/free API
  x86/sev: Add new dump_rmp parameter to snp_leak_pages() API
  x86/startup/sev: Document the CPUID flow in the boot #VC handler
  objtool: Ignore __pi___cfi_ prefixed symbols
  x86/sev: Zap snp_abort()
  x86/apic/savic: Do not use snp_abort()
  x86/boot: Get rid of the .head.text section
  x86/boot: Move startup code out of __head section
  efistub/x86: Remap inittext read-execute when needed
  x86/boot: Create a confined code area for startup code
  x86/kbuild: Incorporate boot/startup/ via Kbuild makefile
  x86/boot: Revert "Reject absolute references in .head.text"
  x86/boot: Check startup code for absence of absolute relocations
  objtool: Add action to check for absence of absolute relocations
  x86/sev: Export startup routines for later use
  x86/sev: Move __sev_[get|put]_ghcb() into separate noinstr object
  x86/sev: Provide PIC aliases for SEV related data objects
  x86/boot: Provide PIC aliases for 5-level paging related constants
  ...
This commit is contained in:
Linus Torvalds
2025-09-30 13:40:35 -07:00
61 changed files with 2043 additions and 709 deletions
+87
View File
@@ -0,0 +1,87 @@
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
/*
* Userspace interface for AMD Seamless Firmware Servicing (SFS)
*
* Copyright (C) 2025 Advanced Micro Devices, Inc.
*
* Author: Ashish Kalra <ashish.kalra@amd.com>
*/
#ifndef __PSP_SFS_USER_H__
#define __PSP_SFS_USER_H__
#include <linux/types.h>
/**
* SFS: AMD Seamless Firmware Support (SFS) interface
*/
#define PAYLOAD_NAME_SIZE 64
#define TEE_EXT_CMD_BUFFER_SIZE 4096
/**
* struct sfs_user_get_fw_versions - get current level of base firmware (output).
* @blob: current level of base firmware for ASP and patch levels (input/output).
* @sfs_status: 32-bit SFS status value (output).
* @sfs_extended_status: 32-bit SFS extended status value (output).
*/
struct sfs_user_get_fw_versions {
__u8 blob[TEE_EXT_CMD_BUFFER_SIZE];
__u32 sfs_status;
__u32 sfs_extended_status;
} __packed;
/**
* struct sfs_user_update_package - update SFS package (input).
* @payload_name: name of SFS package to load, verify and execute (input).
* @sfs_status: 32-bit SFS status value (output).
* @sfs_extended_status: 32-bit SFS extended status value (output).
*/
struct sfs_user_update_package {
char payload_name[PAYLOAD_NAME_SIZE];
__u32 sfs_status;
__u32 sfs_extended_status;
} __packed;
/**
* Seamless Firmware Support (SFS) IOC
*
* possible return codes for all SFS IOCTLs:
* 0: success
* -EINVAL: invalid input
* -E2BIG: excess data passed
* -EFAULT: failed to copy to/from userspace
* -EBUSY: mailbox in recovery or in use
* -ENODEV: driver not bound with PSP device
* -EACCES: request isn't authorized
* -EINVAL: invalid parameter
* -ETIMEDOUT: request timed out
* -EAGAIN: invalid request for state machine
* -ENOENT: not implemented
* -ENFILE: overflow
* -EPERM: invalid signature
* -EIO: PSP I/O error
*/
#define SFS_IOC_TYPE 'S'
/**
* SFSIOCFWVERS - returns blob containing FW versions
* ASP provides the current level of Base Firmware for the ASP
* and the other microprocessors as well as current patch
* level(s).
*/
#define SFSIOCFWVERS _IOWR(SFS_IOC_TYPE, 0x1, struct sfs_user_get_fw_versions)
/**
* SFSIOCUPDATEPKG - updates package/payload
* ASP loads, verifies and executes the SFS package.
* By default, the SFS package/payload is loaded from
* /lib/firmware/amd, but alternative firmware loading
* path can be specified using kernel parameter
* firmware_class.path or the firmware loading path
* can be customized using sysfs file:
* /sys/module/firmware_class/parameters/path.
*/
#define SFSIOCUPDATEPKG _IOWR(SFS_IOC_TYPE, 0x2, struct sfs_user_update_package)
#endif /* __PSP_SFS_USER_H__ */