From nobody Fri Mar 29 02:39:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526384438641719.9430121034696; Tue, 15 May 2018 04:40:38 -0700 (PDT) Received: from localhost ([::1]:32826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIYJp-000569-Rb for importer@patchew.org; Tue, 15 May 2018 07:40:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIYHg-0003p2-Mp for qemu-devel@nongnu.org; Tue, 15 May 2018 07:38:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIYH3-0007Y0-4m for qemu-devel@nongnu.org; Tue, 15 May 2018 07:38:24 -0400 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]:41579) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fIYH2-0007Wm-FG for qemu-devel@nongnu.org; Tue, 15 May 2018 07:37:44 -0400 Received: by mail-wr0-x243.google.com with SMTP id g21-v6so15627879wrb.8 for ; Tue, 15 May 2018 04:37:44 -0700 (PDT) Received: from DESKTOP-OQ1TBVC.localdomain ([89.46.161.178]) by smtp.gmail.com with ESMTPSA id q7-v6sm14937464wrf.49.2018.05.15.04.37.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 May 2018 04:37:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=Gb7jjr1SlFTy8lMYwkNMyUJ7ByKDsYdM9YOVBTXmzbk=; b=njqoePdpuUToH+6mbGoL3OcyouXnksM09Rum41WD6hebgVSA9YEekdM3C90dxrRwts CEBVdEa/BqapilseFYjSbyPYexn/o1q26W0RmHP6ANXESERmJ2yDRkiRyWDny4PO6HGy ljgHPNqipdD5Kf2jZOqlLo6CeMo5FzCp21359++QhcSuIGvjffvVJNLvRmBhbebPQ7fS yNczDDkV6FKiqec1e69GSJ5FwangT6aWUpgH0B0hfYDQkcfqFcbYlmFoVr1Tn4PKO7lC o2VgCErJolVNzm3EKJi7OQtta1fdssF49/o6OJ6ePg+jNUqLFHO723UfkkWr3td044xu 4FTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Gb7jjr1SlFTy8lMYwkNMyUJ7ByKDsYdM9YOVBTXmzbk=; b=AwsM5Vx42eRjPU2O73qfQfrvHaFkvwAxlxh+7TjDfxc3+/ls32ZjFF/vdItMmVOO7l TybHxRJ78QbV8ay2ee1YIr2KNXdB80oJUEZx+/Ls/vww7zPRsgKhPrMoMZHqrb3mNfrm qVswPv+JMsNBI6h9EojuV2eEm9VdZhYcO2Zdol32tGSuTd57qOtYy876lCrtHZZpsey3 kSuARiS/ToVz2foZf79/YoFw2VihSphCoWmfRkLsUnWBxFam8ugO5dvYfTS/Dkac5cZS N8Kvt1uhgW00Il0sBCXAZhTcKgc6JToNP6sOYhMbBb8X8q2WkrWMrs/MIICt967c+rAf kg7w== X-Gm-Message-State: ALKqPwe1bC1FqrmoIShbSeJ4EWF1CuTi7r8ILoOrm43vSeo9tW9G/K9m vIPLniYuRmVr0y4Ue/tcCtQ= X-Google-Smtp-Source: AB8JxZp6YyO3F64JOZqbii4tmqC5N2JFce121He2iZuaH+vNSrusAaROQNKK+Kjvoh28rOMLAaircw== X-Received: by 2002:adf:80cd:: with SMTP id 71-v6mr10131360wrl.238.1526384263063; Tue, 15 May 2018 04:37:43 -0700 (PDT) From: petrutlucian94@gmail.com X-Google-Original-From: lpetrut@cloudbasesolutions.com To: Date: Tue, 15 May 2018 14:37:38 +0300 Message-Id: <1526384258-3581-1-git-send-email-lpetrut@cloudbasesolutions.com> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::243 Subject: [Qemu-devel] [PATCH] WHPX Add signature CPUID X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lucian Petrut , Eduardo Habkost , "open list:All patches CC here" , Alessandro Pilotti , Justin Terry , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Lucian Petrut Adds the CPUID trap for CPUID 0x40000000, sending the WHPX signature to the guest upon request. This is consistent with other QEMU accelerators (KVM). Signed-off-by: Alessandro Pilotti Signed-off-by: Justin Terry (VM) Signed-off-by: Lucian Petrut --- As opposed to the previous patch, this one will set the result of this specific CPUID leaf when initializing the accelerator so that we avoid a vcpu exit. target/i386/whpx-all.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 5843517..c8310de 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -29,6 +29,8 @@ #include #include =20 +#define WHPX_CPUID_SIGNATURE 0x40000000 + struct whpx_state { uint64_t mem_quota; WHV_PARTITION_HANDLE partition; @@ -1342,6 +1344,27 @@ static int whpx_accel_init(MachineState *ms) cpuidExitList, RTL_NUMBER_OF(cpuidExitList) * sizeof(UIN= T32)); =20 + UINT32 signature[3] =3D {0}; + memcpy(signature, "WHPXWHPXWHPX", 12); + + WHV_X64_CPUID_RESULT cpuidResultList[1] =3D {0}; + cpuidResultList[0].Function =3D WHPX_CPUID_SIGNATURE; + cpuidResultList[0].Eax =3D 0; + cpuidResultList[0].Ebx =3D signature[0]; + cpuidResultList[0].Ecx =3D signature[1]; + cpuidResultList[0].Edx =3D signature[2]; + hr =3D WHvSetPartitionProperty(whpx->partition, + WHvPartitionPropertyCodeCpuidResultList, + cpuidResultList, + RTL_NUMBER_OF(cpuidResultList) * + sizeof(WHV_X64_CPUID_RESULT)); + if (FAILED(hr)) { + error_report("WHPX: Failed to set partition CpuidResultList hr=3D%= 08lx", + hr); + ret =3D -EINVAL; + goto error; + } + if (FAILED(hr)) { error_report("WHPX: Failed to set partition CpuidExitList hr=3D%08= lx", hr); --=20 2.7.4