From patchwork Tue Apr 10 23:16:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10334519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 037526053C for ; Tue, 10 Apr 2018 23:17:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F196F28565 for ; Tue, 10 Apr 2018 23:17:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E57D32856E; Tue, 10 Apr 2018 23:17:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4403628565 for ; Tue, 10 Apr 2018 23:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755318AbeDJXRE (ORCPT ); Tue, 10 Apr 2018 19:17:04 -0400 Received: from mail-by2nam01on0081.outbound.protection.outlook.com ([104.47.34.81]:40576 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754584AbeDJXQ0 (ORCPT ); Tue, 10 Apr 2018 19:16:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=O2mRPO7hkCOk8gMQ2T+ETBo83mlT9Yr9ZYYDe5omC5s=; b=CHj0/xfKUDJc2nrAFc4End7/iIUCNJj5RnZz5+zWx+I48vdZmpqOoFaK4WKWYyfM3yhHSIYzkd+H0ZQjuH+E9BGInJ33aetnZouH5ngIhMhGIUgcA3sH7o8vN4bZGIkq3mmgqQYl44k4SCq5tUD3iEYekSbNhnbDZ0U1A9Qa9+M= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from linux-pyp0.amd.com (165.204.77.1) by CY4PR12MB1767.namprd12.prod.outlook.com (2603:10b6:903:122::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Tue, 10 Apr 2018 23:16:20 +0000 From: Babu Moger To: mst@redhat.com, marcel@redhat.com, pbonzini@redhat.com, rth@twiddle.net, ehabkost@redhat.com, mtosatti@redhat.com Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, kash@tripleback.net, geoff@hostfission.com, babu.moger@amd.com Subject: [PATCH v6 2/9] i386: Add cache information in X86CPUDefinition Date: Tue, 10 Apr 2018 19:16:02 -0400 Message-Id: <1523402169-113351-3-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523402169-113351-1-git-send-email-babu.moger@amd.com> References: <1523402169-113351-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR2201CA0048.namprd22.prod.outlook.com (2603:10b6:301:16::22) To CY4PR12MB1767.namprd12.prod.outlook.com (2603:10b6:903:122::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(7193020); SRVR:CY4PR12MB1767; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1767; 3:iH0FjFAXukMMbPH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zGc60pKfpJOiE8LC8BIM7lTBh5wgqudcERaJm8iZNzKaWddJHiKIvdMqTzeWXEaEhM3V38MQMan8QxYgwZxTVm9EFZrqJAsExwgdFQGocznncQHpwDmJqcg276gUGauQLV2cvj3zND7N9OtcjxZLzdXsYgXJdxJEL90cFa5U4D9i5vLNCXc0VUbEENGJ9Vd0ifcRxc2dlU/ZPcsl57iS0Alc1c43COnEjfx4c55qsDcSNHIUwm5AYQqIgfN9mW4XUyB47OKcA5PgXo6zJAeH5J5+rUAwT53O8Lh6FcvGwlVrbIyNbNrA8WJwQlaveWUM2HwZPI93jM; 4:8gkgd35G3gpw5qQVTrFGrGinn8GsTy7xvKLOY1E327+EOoC40OtNmB2ItWNrx5htCQKPEW7fu5IkpzaIVaGzKhnP81QcO0XjSmzMNp6fnNmleuTTpc7fOri8Co2eOTrG3N47wjg4iizQYI/RhG+k8+Ps0m3VXxjEIF4mTaEiR60oyMI6NuC4O8ww3a7y0jvUetrwo/fr4cw1yXsgIO/IKl+d4wQBBrnPLqCOO0Cgpta12t1hVAGdYiE0Y7tbg/iO6Krbz2Rogv+ftYMTkNvNlis47VbnCMoptJ7jtMW+26PJwggFklc6TUPb6Zgs4Zyg X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY4PR12MB1767; BCL:0; PCL:0; RULEID:; SRVR:CY4PR12MB1767; X-Forefront-PRVS: 0638FD5066 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(376002)(366004)(39860400002)(39380400002)(396003)(199004)(189003)(476003)(2906002)(52116002)(26005)(86362001)(50466002)(50226002)(305945005)(5660300001)(186003)(48376002)(7736002)(16526019)(6666003)(25786009)(6116002)(446003)(11346002)(105586002)(4720700003)(2616005)(6486002)(4326008)(956004)(3846002)(66066001)(53416004)(8936002)(386003)(72206003)(478600001)(316002)(16586007)(8676002)(81156014)(81166006)(59450400001)(97736004)(36756003)(47776003)(76176011)(106356001)(7416002)(7696005)(15760500003)(51416003)(68736007)(53936002)(486006); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1767; H:linux-pyp0.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR12MB1767; 23:xa7UZsg0xSlnpCjBAK2HrMHNusSMgNaxPTeTxNZaK?= =?us-ascii?Q?0Jme8aBtFWTQ8BNV3Uh97Crd01dLdva1VhnuCmEj6et09Uq9wT27o1sMVB4D?= =?us-ascii?Q?riyUPkz5lfi1fQX3pxLJ6+ZWxJFVTA7dmv/pfhTx6j8gEBdOdWW0zFg6WpVv?= =?us-ascii?Q?UfStNSv4QEXialb67S51Cgweoz2Bb34KBJ6E6ivpmYaNacnMj3LxMV0AQ+Rc?= =?us-ascii?Q?JWVzEfo3BhRryttcAsSAGox0cf2BT0S1XMVRv0Hh1CTJKQRhghN6WWgammF2?= =?us-ascii?Q?uCNp5MGqxPVAfoz+0RYPcjN8ETF/CmDvlpjFmDdqBwZyjFgL3mKH3iiprNt3?= =?us-ascii?Q?v7Hv0tYxDgid4m3P7eRPm25519IeDzYpnhHT/o+BijBCL+Da4wW6dyOai/xD?= =?us-ascii?Q?MddLZ/WLiI5tBqSKC74SFIAdv20mlk5XeCYMs7rc8GNllzp2kAMPZemxqzZa?= =?us-ascii?Q?VEBYq9cj+mnLKeOB593fGZ/3RpJqv63fdoQRpWJNdMzwMkENtkafV+XpIW3l?= =?us-ascii?Q?chpZEzWv2exZKuCfYc9K98ZkVrpZclFph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ECdobfuqip32pxwvHfwHH1eORcE/R5myvTUQ+4s4gdwvYJKo7fT9rBmlxw35IEx8eemQkNshPkdgVH9dyzrMREYDygsFgwVu3ilFwaKi/3WZSzkx95tMq6bC3cSG3Y; 20:r6/5NS0A7cRnv1IsfQLqBcm1BRK8CJLP3A4pCJSK5lVAZ46A2imXtfEct3KEXEx8xTo+cuwsygxlEvYVwdtSNOzFUVlpfW2iP2RfY8uYwpDTrprTjuRliJVA/tiDFUip7jN7wSgWNvRksJJ42uQ7ivuQfjoVDNAIMS/5Nr0bkeoz7fbMg8Wcn+xApJecj1D+1pw4qCHMlsngPTeuOqfrqSpFIW0AaKybQxoP4KUBiNoVgWhzKY5XFXMIuPBMwBu8 X-MS-Office365-Filtering-Correlation-Id: b34d25c1-f8f4-4a93-60fd-08d59f3912c5 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2018 23:16:20.9358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b34d25c1-f8f4-4a93-60fd-08d59f3912c5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1767 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add cache information in X86CPUDefinition and CPUX86State. Signed-off-by: Babu Moger Tested-by: Geoffrey McRae --- target/i386/cpu.c | 4 ++++ target/i386/cpu.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 2d3d7d8..8c84fa2 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1098,6 +1098,7 @@ struct X86CPUDefinition { int stepping; FeatureWordArray features; const char *model_id; + CPUCaches cache_info; }; static X86CPUDefinition builtin_x86_defs[] = { @@ -3235,6 +3236,9 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **errp) env->features[w] = def->features[w]; } + /* Load Cache information from the X86CPUDefinition */ + memcpy(&env->cache_info, &def->cache_info, sizeof(CPUCaches)); + /* Special cases not set in the X86CPUDefinition structs: */ /* TODO: in-kernel irqchip for hvf */ if (kvm_enabled()) { diff --git a/target/i386/cpu.h b/target/i386/cpu.h index eaed287..aff8396 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1096,6 +1096,13 @@ typedef struct CPUCacheInfo { } CPUCacheInfo; +typedef struct CPUCaches { + bool valid; + CPUCacheInfo l1d_cache; + CPUCacheInfo l1i_cache; + CPUCacheInfo l2_cache; + CPUCacheInfo l3_cache; +} CPUCaches; typedef struct CPUX86State { /* standard registers */ @@ -1282,6 +1289,7 @@ typedef struct CPUX86State { /* Features that were explicitly enabled/disabled */ FeatureWordArray user_features; uint32_t cpuid_model[12]; + CPUCaches cache_info; /* MTRRs */ uint64_t mtrr_fixed[11];