From patchwork Thu Apr 26 16:26:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Babu Moger X-Patchwork-Id: 10366319 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 E4E56601D3 for ; Thu, 26 Apr 2018 16:27:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6DCE28520 for ; Thu, 26 Apr 2018 16:27:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB50C28604; Thu, 26 Apr 2018 16:27:12 +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 4524028520 for ; Thu, 26 Apr 2018 16:27:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932150AbeDZQ1J (ORCPT ); Thu, 26 Apr 2018 12:27:09 -0400 Received: from mail-sn1nam01on0058.outbound.protection.outlook.com ([104.47.32.58]:3008 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754553AbeDZQ1F (ORCPT ); Thu, 26 Apr 2018 12:27:05 -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=L4z2dWSqJNIBCjFfulphUKnoTUKwOhXAQ1u9KzdD6c8=; b=PdHtaNFIVokDO5lPZIF5dKbEC/RygsADk5zSCLN+pk5sElKeDQ+tWueSSxfwMzhHDtv2X6AIA7hKuaG4c0Trx0MUPv+s2BepkaZERZmAErQcz2ovqUaU+AWDUvjfe96DWgQeJFH5BBs7eNqwpwTCrUvCofrtZBjWt11UbloBSWQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Babu.Moger@amd.com; Received: from bmoger-ubuntu.amd.com (165.204.78.1) by SN1PR12MB2479.namprd12.prod.outlook.com (2603:10b6:802:29::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.696.13; Thu, 26 Apr 2018 16:27:00 +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 v7 2/9] i386: Add cache information in X86CPUDefinition Date: Thu, 26 Apr 2018 11:26:42 -0500 Message-Id: <1524760009-24710-3-git-send-email-babu.moger@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524760009-24710-1-git-send-email-babu.moger@amd.com> References: <1524760009-24710-1-git-send-email-babu.moger@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: CY4PR1801CA0020.namprd18.prod.outlook.com (2603:10b6:910:74::33) To SN1PR12MB2479.namprd12.prod.outlook.com (2603:10b6:802:29::18) 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:SN1PR12MB2479; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB2479; 3:HPWwQrK/AEqsnouB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nlyks7TG51o7abfahT5k5B00XS/ZL5UwRtv2jIv2ukRi1U4SGf+LShA0szSa9aVGcLemGIva3Z0MaYiR3Ok6SEgdSJhgvf2IOCvsIP9dL5rbLtY9NkhBkFeCSEkfL1BFG4AAPoqgs+IGpUEzmRyt4bTxhm4wc8uNPo/j/jeORY4xXYXCtTTGEFhsoGWNmZpwMmnRyCIpfyqzLEP1qhzB4iMXfPuTjs5oXpcr9c1e0kN6yCbg0VkJAF3jJFcA+i3w85YDK0k1FlG9vWTAxcGp4aLljO7S/g6zcGvXtuZMPWb4DCvlqKgBKZf5e5LuUZG6X4rfe6ZSCy43; 4:F0dG0VAZsPuLBJn1dWlF49/oGntWeWvcVpaOapDxbrRf37xam4L17DIwSFXefHLjH3cVtqVvWlM7eLO7mOQmrK+oNDfVK0dMvNSvz8CYFyp+E+fNLSPbhUzUBKTZ59Di4I0RtP+3oMyvcqHJMJnyCPZe9yrs/T6vG70xSFB82uhEJ1y0WoUzJxeGtYC2feCLsoSfz6sEhwZiPxHfmzN9YeFupwqe1uNUABvXVxGSkhWOfWbTPEbnZjHclwWOHRfcl7m2GMOF63UpjYqrXoqCs56DKfizJlfNXmSHnqhRdbZo23GLU5GGgG0Z4XCUOwyy 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)(10201501046)(3002001)(3231232)(944501410)(52105095)(6055026)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011); SRVR:SN1PR12MB2479; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB2479; X-Forefront-PRVS: 0654257CF5 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(376002)(396003)(39860400002)(346002)(189003)(199004)(68736007)(8676002)(2906002)(6116002)(76176011)(8936002)(5660300001)(316002)(3846002)(4326008)(81156014)(50226002)(81166006)(386003)(956004)(16526019)(7416002)(15760500003)(52116002)(476003)(97736004)(59450400001)(186003)(25786009)(86362001)(446003)(7696005)(11346002)(51416003)(26005)(48376002)(36756003)(16586007)(47776003)(53416004)(486006)(44832011)(106356001)(7736002)(575784001)(6666003)(72206003)(2616005)(6486002)(105586002)(66066001)(478600001)(305945005)(53936002)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB2479; H:bmoger-ubuntu.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB2479; 23:UgsqIEOjc+CMvTi0RnALQS4RETMctOpdiXc1DjX5R?= =?us-ascii?Q?00iwPWikFgPCpxe3UCLaDmWOYRaWBmQu5OXfk2rKlTFoESfKHcTmlSZ+5CkP?= =?us-ascii?Q?YaCPc9Zt2tGUyNJbA3X1ufcfTshbhNu/FMlfQohmyoNUs4HN2oOIVn5oxBu7?= =?us-ascii?Q?LsAg+CYCdiBQ2uMUKEBQw+rMV0uvyRK3zXpEqbCw9Rt2SGmZtzglXMNGPiKz?= =?us-ascii?Q?hY4UlylU4Zmuil7wzHy1YbzV/dUUBSmAX+PMiaDzsb7g8NI0Zv3Xr1wtaOxA?= =?us-ascii?Q?5+pYIzC+iIRPDzQFYq23T6su3+10tTMf2P0Hp3+4WVsoUtluNZp93Dr9I9V8?= =?us-ascii?Q?PbwUOnzOCTEW481Uuf59ERm+GLBU/3JuGfpRRiQ0w1egWpwXtHHfucohh9PC?= =?us-ascii?Q?onStGwk6NlQQjLI5rlrvKKgaUf9QexHiel2A8/YmOK3JkPHqgPnnp9lXts44?= =?us-ascii?Q?ezUgVOwS7KrO9Yjhtw9Kqai6V6hcGV44YNhms+a6eKWlbOU3B8gPGVdN1h5B?= =?us-ascii?Q?tv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AbFERGquLlpJ/xAUMTp5ug4pPMDDpGEXyp/yDbkE1p3laa4y7H/+Zwy+PcChSlmrkJ3zZfk3BDqKC5887OQ3l4Nz2qEo2btnbvQl+ZDUR+tqKNaaj+O/WhKXqv2iQifpKUUBwkEVoIkcJ6F4ULBqY3ScM10HG4LcsSg/m; 20:QlxOeSe4bzrxJvU0YRu+CW+weOj8ureyRFNiKjKLCYwZQauXhKmnvy1q/JIyYNZqSFoLNq+L2u8oISgzSfFCYBRnfuY6+VkSmqOkNk0AtI/tvYsxx+LgWmA+f150JqWRO589JeIwDUd7ZMGqinfOottqAe/ZLJNj3xQJFWycejAsTQzyDqngT9Cx1M1xCbF7tna5fE8A6iYIk3/AO6fjn2DZ234gtqkfP41tQhfkHJz7lM3N7KfhY6OyiqAMY0l2 X-MS-Office365-Filtering-Correlation-Id: b9222e35-1f3a-4c58-2fe4-08d5ab928a04 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2018 16:27:00.3148 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9222e35-1f3a-4c58-2fe4-08d5ab928a04 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2479 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 Reviewed-by: Eduardo Habkost --- 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 b6c1592..a518a0f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1105,6 +1105,7 @@ struct X86CPUDefinition { int stepping; FeatureWordArray features; const char *model_id; + CPUCaches cache_info; }; static X86CPUDefinition builtin_x86_defs[] = { @@ -3242,6 +3243,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 fa03e2c..1213bb7 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];