From patchwork Sat Oct 2 12:52:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12532067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D708C433F5 for ; Sat, 2 Oct 2021 12:53:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 434FD61ACE for ; Sat, 2 Oct 2021 12:53:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233209AbhJBMzJ (ORCPT ); Sat, 2 Oct 2021 08:55:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59300 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232823AbhJBMzI (ORCPT ); Sat, 2 Oct 2021 08:55:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633179201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Ib9ELo2khl9yldyMRwflp0UN303ciEAFS7yOmdsrtJM=; b=DAKxbi0BMvpZNO/Fya7VAAg4PwH86pPmvta7pLZmkJIFdUizGxzYwJ2PK7tLJ2Ut3QjVZp W75/PYDzn8rQLy98ySQ8oYxCkYEbvq8OqulLAij8MD8Tigjnv/4jLgiQZZHtY4KPjpMVg/ rTuvGGbunhDzmegeQOebs12dr5Lbs9Y= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-331-3dizRT_yOrqXiNBruNabVQ-1; Sat, 02 Oct 2021 08:53:21 -0400 X-MC-Unique: 3dizRT_yOrqXiNBruNabVQ-1 Received: by mail-wm1-f72.google.com with SMTP id 10-20020a05600c240a00b0030d403f24e2so3204248wmp.9 for ; Sat, 02 Oct 2021 05:53:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ib9ELo2khl9yldyMRwflp0UN303ciEAFS7yOmdsrtJM=; b=MY5AYZNNX3uNw/wHiQiHDBY5THjVcKgugA8SP/wEcOAMpyNrtAoRe50NbHtx1pEGNE QNfaYKcosnk+pV4ZmfYQhkBE0CKnMhVHpkG1PEyH6v18aZBuFocVU5AwpB2QoeYrFoZh NkU1iTOpG3i+BHSUjmYj43YRf5HNdFMBZPrkH1yZBvxYKFek7XekHbSRG7Z6jEwgI7gs 6YzXAX0QBmOtTOHyOXM582M3SPdNsqhyN/LfTCWzso5a/+4/SqL/aGQwYp6TrWiT/6FK CMc2ftFFXpW6eTlC5WJscq7DygcE4ishVlo7D1BvqOX6kQoGrEJkRYVNRUAi/bTz6qxM umjg== X-Gm-Message-State: AOAM531u29TGHmL0wm6J+EiGkVyBRC96bsnDlH4ST0uRnhU7VBBRFUaZ a8HVz4JG9XetxSup4QVGHQfnayyxNgpLRQN5Y8Qf2kkIz/tH4GLz/C7MQyGY6kbNNYqxIjT5Ph8 1HvlCFYEmuKyZ X-Received: by 2002:adf:8bcf:: with SMTP id w15mr3445863wra.144.1633179199568; Sat, 02 Oct 2021 05:53:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxmJJVJtij1cYhaOoS1a2n3oM4h81AupX1+DD9gs6imh/k3aWK6DwR8Pisb94OyZBbpntRePg== X-Received: by 2002:adf:8bcf:: with SMTP id w15mr3445845wra.144.1633179199336; Sat, 02 Oct 2021 05:53:19 -0700 (PDT) Received: from x1w.. (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id i2sm8378777wrq.78.2021.10.02.05.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Oct 2021 05:53:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Dr . David Alan Gilbert" , Dov Murik , Sergio Lopez , kvm@vger.kernel.org, James Bottomley , Eduardo Habkost , Paolo Bonzini , Brijesh Singh , "Daniel P . Berrange" Subject: [PATCH v3 00/22] target/i386/sev: Housekeeping SEV + measured Linux SEV guest Date: Sat, 2 Oct 2021 14:52:55 +0200 Message-Id: <20211002125317.3418648-1-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi, While testing James & Dov patch: https://www.mail-archive.com/qemu-devel@nongnu.org/msg810571.html I wasted some time trying to figure out how OVMF was supposed to behave until realizing the binary I was using was built without SEV support... Then wrote this series to help other developers to not hit the same problem. Since v2: - Rebased on top of SGX - Addressed review comments from Markus / David - Included/rebased 'Measured Linux SEV guest' from Dov [1] - Added orphean MAINTAINERS section [1] https://lore.kernel.org/qemu-devel/20210825073538.959525-1-dovmurik@linux.ibm.com/ Supersedes: <20210616204328.2611406-1-philmd@redhat.com> Dov Murik (2): sev/i386: Introduce sev_add_kernel_loader_hashes for measured linux boot x86/sev: generate SEV kernel loader hashes in x86_load_linux Dr. David Alan Gilbert (1): target/i386/sev: sev_get_attestation_report use g_autofree Philippe Mathieu-Daudé (19): qapi/misc-target: Wrap long 'SEV Attestation Report' long lines qapi/misc-target: Group SEV QAPI definitions target/i386/kvm: Introduce i386_softmmu_kvm Meson source set target/i386/kvm: Restrict SEV stubs to x86 architecture target/i386/monitor: Return QMP error when SEV is disabled in build target/i386/cpu: Add missing 'qapi/error.h' header target/i386/sev_i386.h: Remove unused headers target/i386/sev: Remove sev_get_me_mask() target/i386/sev: Mark unreachable code with g_assert_not_reached() target/i386/sev: Restrict SEV to system emulation target/i386/sev: Declare system-specific functions in 'sev_i386.h' target/i386/sev: Remove stubs by using code elision target/i386/sev: Move qmp_query_sev_attestation_report() to sev.c target/i386/sev: Move qmp_sev_inject_launch_secret() to sev.c target/i386/sev: Move qmp_query_sev_capabilities() to sev.c target/i386/sev: Move qmp_query_sev_launch_measure() to sev.c target/i386/sev: Move qmp_query_sev() & hmp_info_sev() to sev.c monitor: Restrict 'info sev' to x86 targets MAINTAINERS: Cover AMD SEV files qapi/misc-target.json | 77 ++++---- include/monitor/hmp-target.h | 1 + include/monitor/hmp.h | 1 - include/sysemu/sev.h | 20 +- target/i386/sev_i386.h | 32 +-- hw/i386/pc_sysfw.c | 2 +- hw/i386/x86.c | 25 ++- target/i386/cpu.c | 17 +- {accel => target/i386}/kvm/sev-stub.c | 0 target/i386/monitor.c | 92 +-------- target/i386/sev-stub.c | 83 -------- target/i386/sev-sysemu-stub.c | 70 +++++++ target/i386/sev.c | 268 +++++++++++++++++++++++--- MAINTAINERS | 7 + accel/kvm/meson.build | 1 - target/i386/kvm/meson.build | 8 +- target/i386/meson.build | 4 +- 17 files changed, 438 insertions(+), 270 deletions(-) rename {accel => target/i386}/kvm/sev-stub.c (100%) delete mode 100644 target/i386/sev-stub.c create mode 100644 target/i386/sev-sysemu-stub.c