Skip to content

abi: support Siena product line #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions abi/abi.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,18 @@ const (
familyShift = 8
modelShift = 4
// Combined extended values
zen3zen4Family = 0x19
zen5Family = 0x1A
milanModel = 0 | 1
genoaModel = (1 << 4) | 1
turinModel = 2
zen3zen4Family = 0x19
zen5Family = 0x1A
milanModelCombined = 0 | 1
genoaModelCombined = (1 << 4) | 1
turinModelCombined = 2
// Non-combined extended values
// See page 8, table 4 of https://web.archive.org/web/20250522130154/https://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/57230.pdf
milanModel = 0
genoaModel = 1
sienaModel = 0xA
turinModelA = 0
turinModelB = 1

// ReportVersion2 is set by the SNP API specification
// https://web.archive.org/web/20231222054111if_/http://www.amd.com/content/dam/amd/en/documents/epyc-technical-docs/specifications/56860.pdf
Expand Down Expand Up @@ -994,6 +1001,7 @@ func FmsFromCpuid1Eax(eax uint32) (byte, byte, byte) {
// SevProductFromCpuid1Eax returns the SevProduct that is represented by cpuid(1).eax.
func SevProductFromCpuid1Eax(eax uint32) *pb.SevProduct {
family, model, stepping := FmsFromCpuid1Eax(eax)
extendedModel := model >> 4
// Ah, Fh, {0h,1h} values from the KDS specification,
// section "Determining the Product Name".
var productName pb.SevProduct_SevProductName
Expand All @@ -1004,17 +1012,17 @@ func SevProductFromCpuid1Eax(eax uint32) *pb.SevProduct {
// Product information specified by processor programming reference publications.
switch family {
case zen3zen4Family:
switch model {
switch extendedModel {
case milanModel:
productName = pb.SevProduct_SEV_PRODUCT_MILAN
case genoaModel:
case genoaModel, sienaModel:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Siena model in the zen4 family should still have the Siena product name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking back in about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, unfortunately, I don't have access to the machine I tested this on (a Siena one) anymore. I'll see what I can do - the change you've mentioned should not be a problem at least :P

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should try to claim support without running on hardware. I also don't have access to a siena machine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, would propose for closing this for now then.

productName = pb.SevProduct_SEV_PRODUCT_GENOA
default:
unknown()
}
case zen5Family:
switch model {
case turinModel:
switch extendedModel {
case turinModelA, turinModelB:
productName = pb.SevProduct_SEV_PRODUCT_TURIN
default:
unknown()
Expand All @@ -1041,13 +1049,13 @@ func MaskedCpuid1EaxFromSevProduct(product *pb.SevProduct) uint32 {
switch product.Name {
case pb.SevProduct_SEV_PRODUCT_MILAN:
family = zen3zen4Family
model = milanModel
model = milanModelCombined
case pb.SevProduct_SEV_PRODUCT_GENOA:
family = zen3zen4Family
model = genoaModel
model = genoaModelCombined
case pb.SevProduct_SEV_PRODUCT_TURIN:
family = zen5Family
model = turinModel
model = turinModelCombined
default:
return 0
}
Expand Down
Loading