[PATCH 0/1] Add support for AMD new-style boot mechanism.

Danny Milosavljevic posted 1 patch 3 years, 2 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210301161432.22554-1-danny.milo@datacom.wien
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Alistair Francis <alistair@alistair23.me>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <richard.henderson@linaro.org>
There is a newer version of this series
hw/core/generic-loader.c         |  5 ++++-
include/hw/core/cpu.h            |  1 +
include/hw/core/generic-loader.h |  1 +
target/i386/cpu.c                | 11 +++++++++++
4 files changed, 17 insertions(+), 1 deletion(-)
[PATCH 0/1] Add support for AMD new-style boot mechanism.
Posted by Danny Milosavljevic 3 years, 2 months ago
A lot of AMD CPUs boot the bootstrap processor using a new mechanism.

According to https://doc.coreboot.org/soc/amd/family17h.html [1] that means
that the flash header specifies a destination and size in RAM (!), and the
bootstrap processor will start using a CS segment descriptor set up in such
a way that from the CPU's point of view, 0xf000:0xffff is the last byte of
the loaded blob (i.e. of the BIOS).

See <https://doc.coreboot.org/soc/amd/family17h.html>, which says:

>Picasso Reset Vector and First Instructions
[example]
>Flash BIOS Directory Table
>destination = 0x9b00000
>size  = 0x300000

>... then the BIOS image is placed at the topmost position the region
>0x9b00000-0x9dfffff and

>reset_vector = 0x9dffff0
>CS_shdw_base = 0x9df0000
>CS:IP  = 0xf000:0xfff0

The patch below allows the user to set up CS_shdw_base.

In order to test, try

qemu-system-x86_64 \
   -m 1G \
   -device loader,file=BIOS.fd,csbaseaddr=0x9df0000,addr=$0x9b00000,cpu-num=0,force-raw=on \
   -device loader,addr=0xfff0,cpu-num=0 \
   -bios BIOS.fd

The "-bios BIOS.fd" at the end is optional--but customary.

This has been used successfully for more than a year in BIOS development.

Danny Milosavljevic (1):
  i386: Add support for AMD new-style boot mechanism.

 hw/core/generic-loader.c         |  5 ++++-
 include/hw/core/cpu.h            |  1 +
 include/hw/core/generic-loader.h |  1 +
 target/i386/cpu.c                | 11 +++++++++++
 4 files changed, 17 insertions(+), 1 deletion(-)

[1] http://web.archive.org/web/20201125131718/https://doc.coreboot.org/soc/amd/family17h.html
-- 
2.29.2


Re: [PATCH 0/1] Add support for AMD new-style boot mechanism.
Posted by no-reply@patchew.org 3 years, 2 months ago
Patchew URL: https://patchew.org/QEMU/20210301161432.22554-1-danny.milo@datacom.wien/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210301161432.22554-1-danny.milo@datacom.wien
Subject: [PATCH 0/1] Add support for AMD new-style boot mechanism.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20210301161432.22554-1-danny.milo@datacom.wien -> patchew/20210301161432.22554-1-danny.milo@datacom.wien
Switched to a new branch 'test'
aa53a74 i386: Add support for AMD new-style boot mechanism.

=== OUTPUT BEGIN ===
ERROR: braces {} are necessary for all arms of this statement
#27: FILE: hw/core/generic-loader.c:56:
+            if (cc->set_csbase)
[...]

WARNING: line over 80 characters
#45: FILE: hw/core/generic-loader.c:185:
+    DEFINE_PROP_UINT64("csbaseaddr", GenericLoaderState, csbaseaddr, 0xffff0000),

total: 1 errors, 1 warnings, 60 lines checked

Commit aa53a7429c8b (i386: Add support for AMD new-style boot mechanism.) has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210301161432.22554-1-danny.milo@datacom.wien/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com