From patchwork Fri Jan 22 00:18:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Komlodi X-Patchwork-Id: 1430147 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-xilinx-onmicrosoft-com header.b=JKMtGXic; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DMKym3gfyz9s24 for ; Fri, 22 Jan 2021 11:34:40 +1100 (AEDT) Received: from localhost ([::1]:33978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2kPO-0006rO-ET for incoming@patchwork.ozlabs.org; Thu, 21 Jan 2021 19:34:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2kOs-0006pT-6P for qemu-devel@nongnu.org; Thu, 21 Jan 2021 19:34:06 -0500 Received: from mail-bn7nam10on2082.outbound.protection.outlook.com ([40.107.92.82]:58230 helo=NAM10-BN7-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2kOo-0007oP-T1 for qemu-devel@nongnu.org; Thu, 21 Jan 2021 19:34:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oMDhDxfCOewetUWHliXwBBUAh+NHsIr+5KsOztHV+UOv3boE0jiz3WLGJrUu6DBz6pXeEieELuP+2rKgJkWCDE8F7g14dG/UIieBusNC8JvHE8rQFKsy2OYhhVQbW5loisEQvx2+20ytuFVVU9BFBXEX9PMxhBYHccDJa10dTDIrqQyFf4yJR0w2hk9wNbKInA0lYRJ018ZIEJPMTAtdcgp+AU1FLgdbUO+ctirlaXUgx2HbbENeyGWBtNooR6k2HukxHVWsUkXlcdAINEwT53XxwpLEv/ntD779PLENtOw8Foz/9dQyhCCNTpW93vNkFLVd809riZw0IMq5r9X29A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R4ozdW8ksfqNUFtV9QhUiLIVNqJVXdfNXgs+8xrp8bY=; b=BonnmSbWVKGgxcyuc+CqJV9BBkl7SwwmnGslPeTXjKyzDySSaV05xF/DcgfhKoi4TKAoarnHEoK87OlQO2L7KNYrixb+/mbUB2D87r8S4E4W+8g5QD4mpP23xGwf9j+oiBZ0kJrkw/mmsaX0SJ3nn8GanydLpd0Q2V/tTsZ6ojeTJDd7bA4NP98Fc8cmJjFHFQu5BPJS7ZDqEcM9QD8HojI2z/5JfjVjiHsgu9cW1R99jsK0sLC/2snDYLPDHPkni2X1hJUsmByYtpoiMjLBoOijW1dc5MY6G9PSS4Oovunt76l1o8on1f/1//progaXB4mcXFD0saJeNlAny1qEFg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=nongnu.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=R4ozdW8ksfqNUFtV9QhUiLIVNqJVXdfNXgs+8xrp8bY=; b=JKMtGXicNNLg+NDiStrnOkR/BIKVopgGYQaeYi+QVyBl+axkDfwRa8YPqwcQ3a5b6Co57NBc+idfb71arXZdq0hfkK/x2YApgqS1pMQmkpqdnJ51nTS7wjhAHbhhpTG880o++NyIBostrwnUGnm/3wK+mNvyY/wDH778liTm7K4= Received: from BL1PR13CA0175.namprd13.prod.outlook.com (2603:10b6:208:2bd::30) by BYAPR02MB4056.namprd02.prod.outlook.com (2603:10b6:a02:fa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 00:18:57 +0000 Received: from BL2NAM02FT024.eop-nam02.prod.protection.outlook.com (2603:10b6:208:2bd:cafe::71) by BL1PR13CA0175.outlook.office365.com (2603:10b6:208:2bd::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6 via Frontend Transport; Fri, 22 Jan 2021 00:18:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BL2NAM02FT024.mail.protection.outlook.com (10.152.77.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 00:18:56 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Thu, 21 Jan 2021 16:18:55 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Thu, 21 Jan 2021 16:18:55 -0800 Received: from [172.19.2.32] (port=58488 helo=xsjkomlodi50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1l2kAB-0001Bj-IG; Thu, 21 Jan 2021 16:18:55 -0800 From: Joe Komlodi To: Subject: [PATCH v1 1/3] target/microblaze: Add use-non-secure property Date: Thu, 21 Jan 2021 16:18:53 -0800 Message-ID: <1611274735-303873-2-git-send-email-komlodi@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1611274735-303873-1-git-send-email-komlodi@xilinx.com> References: <1611274735-303873-1-git-send-email-komlodi@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bf73cf19-24a3-4611-6b30-08d8be6b4eea X-MS-TrafficTypeDiagnostic: BYAPR02MB4056: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JoUYZPG/1BzkSzmtTrMQTNY2LFdAlBJvDWXCT1Zq6h6ohiINy/phZirqU9osIf9nQchORNt75hGw5kMxDx1A8sgdBRL3re/L0cXinC83M56q3Np5Rv4YZgtzjGoczkx0EXAkUQFCJxg29kXWMbycCg1s8vnG/A79bjj3349V0XVhLzqqwMOemZlXBHSYik5C+kIf6n6KG6KhthaHs3o3Ozjtc4yhNjJ4y4lof5t3PhRytU+ihTkbt3TlfKGplnuRJQJOlVv9+QaGvALrKc6zqjgi3XX0evmJ2CiaWRB/Wd8AzUNIhIyZlyR2W8QSvAGyOf/iTrJPGOq09ZQzuS0tnMtj4skySnjiHcaR3nUGn0UheGVdwvsnZCF0ItCKn2jTnlKaXwdNc9/VqTW61FfNvx00sfZsXEsyBGMsvoUoXER2gQPEH2DuYGddOKWKEjqayKrNzdaBBQuxr1vuKesCSy3FGoLosFiVvxS2fsIyDbzkvmStH2uoKEdjVQbE+Ays1UOlo+IAfWBailptj71N32KIqjQQ3pwZmlJ/8xWdvOIQW7FKtH4M6vTd5JtqTrFk X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(376002)(396003)(39860400002)(136003)(46966006)(36756003)(2906002)(8676002)(83380400001)(7696005)(9786002)(82740400003)(82310400003)(966005)(8936002)(7636003)(356005)(316002)(36906005)(6916009)(107886003)(5660300002)(426003)(86362001)(478600001)(44832011)(70206006)(336012)(186003)(4326008)(47076005)(70586007)(2616005)(26005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 00:18:56.6259 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf73cf19-24a3-4611-6b30-08d8be6b4eea X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BL2NAM02FT024.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4056 Received-SPF: pass client-ip=40.107.92.82; envelope-from=komlodi@xilinx.com; helo=NAM10-BN7-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgari@xilinx.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This property is used to control the security of the following interfaces on MicroBlaze: M_AXI_DP - data interface M_AXI_IP - instruction interface M_AXI_DC - dcache interface M_AXI_IC - icache interface It works by enabling or disabling the use of the non_secure[3:0] signals. Interfaces and their corresponding values are taken from: https://www.xilinx.com/support/documentation/sw_manuals/xilinx2020_2/ug984-vivado-microblaze-ref.pdf page 153. Signed-off-by: Joe Komlodi Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias --- target/microblaze/cpu.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ target/microblaze/cpu.h | 11 +++++++++++ 2 files changed, 57 insertions(+) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index c8e754c..accfb23 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -98,6 +98,38 @@ static bool mb_cpu_has_work(CPUState *cs) } #ifndef CONFIG_USER_ONLY +static void mb_cpu_ns_axi_dp(void *opaque, int irq, int level) +{ + MicroBlazeCPU *cpu = opaque; + bool en = cpu->cfg.use_non_secure & USE_NON_SECURE_M_AXI_DP_MASK; + + cpu->ns_axi_dp = level & en; +} + +static void mb_cpu_ns_axi_ip(void *opaque, int irq, int level) +{ + MicroBlazeCPU *cpu = opaque; + bool en = cpu->cfg.use_non_secure & USE_NON_SECURE_M_AXI_IP_MASK; + + cpu->ns_axi_ip = level & en; +} + +static void mb_cpu_ns_axi_dc(void *opaque, int irq, int level) +{ + MicroBlazeCPU *cpu = opaque; + bool en = cpu->cfg.use_non_secure & USE_NON_SECURE_M_AXI_DC_MASK; + + cpu->ns_axi_dc = level & en; +} + +static void mb_cpu_ns_axi_ic(void *opaque, int irq, int level) +{ + MicroBlazeCPU *cpu = opaque; + bool en = cpu->cfg.use_non_secure & USE_NON_SECURE_M_AXI_IC_MASK; + + cpu->ns_axi_ic = level & en; +} + static void microblaze_cpu_set_irq(void *opaque, int irq, int level) { MicroBlazeCPU *cpu = opaque; @@ -248,6 +280,10 @@ static void mb_cpu_initfn(Object *obj) #ifndef CONFIG_USER_ONLY /* Inbound IRQ and FIR lines */ qdev_init_gpio_in(DEVICE(cpu), microblaze_cpu_set_irq, 2); + qdev_init_gpio_in_named(DEVICE(cpu), mb_cpu_ns_axi_dp, "ns_axi_dp", 1); + qdev_init_gpio_in_named(DEVICE(cpu), mb_cpu_ns_axi_ip, "ns_axi_ip", 1); + qdev_init_gpio_in_named(DEVICE(cpu), mb_cpu_ns_axi_dc, "ns_axi_dc", 1); + qdev_init_gpio_in_named(DEVICE(cpu), mb_cpu_ns_axi_ic, "ns_axi_ic", 1); #endif } @@ -277,6 +313,16 @@ static Property mb_properties[] = { DEFINE_PROP_BOOL("use-msr-instr", MicroBlazeCPU, cfg.use_msr_instr, true), DEFINE_PROP_BOOL("use-pcmp-instr", MicroBlazeCPU, cfg.use_pcmp_instr, true), DEFINE_PROP_BOOL("use-mmu", MicroBlazeCPU, cfg.use_mmu, true), + /* + * use-non-secure enables/disables the use of the non_secure[3:0] signals. + * It is a bitfield where 1 = non-secure for the following bits and their + * corresponding interfaces: + * 0x1 - M_AXI_DP + * 0x2 - M_AXI_IP + * 0x4 - M_AXI_DC + * 0x8 - M_AXI_IC + */ + DEFINE_PROP_UINT8("use-non-secure", MicroBlazeCPU, cfg.use_non_secure, 0), DEFINE_PROP_BOOL("dcache-writeback", MicroBlazeCPU, cfg.dcache_writeback, false), DEFINE_PROP_BOOL("endianness", MicroBlazeCPU, cfg.endi, false), diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index c1c2641..199cfb0 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -233,6 +233,12 @@ typedef struct CPUMBState CPUMBState; #define TARGET_INSN_START_EXTRA_WORDS 1 +/* use-non-secure property masks */ +#define USE_NON_SECURE_M_AXI_DP_MASK 0x1 +#define USE_NON_SECURE_M_AXI_IP_MASK 0x2 +#define USE_NON_SECURE_M_AXI_DC_MASK 0x4 +#define USE_NON_SECURE_M_AXI_IC_MASK 0x8 + struct CPUMBState { uint32_t bvalue; /* TCG temporary, only valid during a TB */ uint32_t btarget; /* Full resolved branch destination */ @@ -316,6 +322,7 @@ typedef struct { bool use_msr_instr; bool use_pcmp_instr; bool use_mmu; + uint8_t use_non_secure; bool dcache_writeback; bool endi; bool dopb_bus_exception; @@ -337,6 +344,10 @@ struct MicroBlazeCPU { CPUState parent_obj; /*< public >*/ + bool ns_axi_dp; + bool ns_axi_ip; + bool ns_axi_dc; + bool ns_axi_ic; CPUNegativeOffsetState neg; CPUMBState env; From patchwork Fri Jan 22 00:18:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Komlodi X-Patchwork-Id: 1430148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-xilinx-onmicrosoft-com header.b=dqzhyTIx; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DML0T6HDTz9s24 for ; Fri, 22 Jan 2021 11:36:09 +1100 (AEDT) Received: from localhost ([::1]:38280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2kQp-0000BI-RP for incoming@patchwork.ozlabs.org; Thu, 21 Jan 2021 19:36:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2kOs-0006pG-6N for qemu-devel@nongnu.org; Thu, 21 Jan 2021 19:34:06 -0500 Received: from mail-mw2nam10on2050.outbound.protection.outlook.com ([40.107.94.50]:37345 helo=NAM10-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2kOo-0007oN-Sm for qemu-devel@nongnu.org; Thu, 21 Jan 2021 19:34:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H2OzQBCk7EahAE9osj5PVU/K+a72Majr1ehvum0YAY3evHJKMEw0lBsAGDqWb4cJ/1f5NKFxryGntnI3M2J+SJVTAC0nLu188x1Y3+pNdVgPielVEj5YSgrZib+FaIxwSsIEBphZKrHQteR8iOBPdw2iwWZp9ggSR6RZD1Czh/hQSo6L+8asHie19APFAcrcUAXrr4h1kJfbIQr0Qc3ND1d/d6n3LaJ8lznI0Tzex1oqqaqdjsQUPGw6xr2reCLAsoFQZ2xTixQ+x3JVFsaL6wJj9550F/pMHhLQWCQAOYwJJesc/80YYkI3eDlE0FYmnLhhRjhJKaIxZHDTMKTiWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sPjsKADjF+j6Ffy7aC9+ZvgznwFj7g+f4gmUdTd923I=; b=j/ETmnNNUupj1KyzU+wqSH+Lp88nBcIpjozNZunT0VpEq77f20aPpY8XawpIEL9qQ/5lrsz9essdGC7A+LK+EQMnkLuwt7vFwrB056mYRUI4TkGZScz6va7CnKktFWuA7BppKWbCEr9/YzXTWI7kiTpsbuN3UCKHh1RY5BcYB3tbLtb1ArkmZLHa19f5IVEUbg/y5nKLpDFmMHoJmlOeLhRgObnMDp3amFJPZXCGDUX3NHOTuADV7YBNM2c/6vMrgs0s65TqE5U9iICxVJgBgUphIYhnKBSTmhwvGin1ItJvJLPDJ1HJpGjZCssCxpx4QaSVZ5H0qX6+F2hPG4+khQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=nongnu.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sPjsKADjF+j6Ffy7aC9+ZvgznwFj7g+f4gmUdTd923I=; b=dqzhyTIxCt3Cf9Cb0SFuuG1P1JTlk9e4SbqytN42vrUF3W9FViUaAc7OHYKYUo2ptB92ic2F4uOFl4faejFZ34lkH59J0RsAap4W9X7/LDYP/r+9siNaaXWyqEQVtqacVrwwBeABcy9HXwrL6Mt2UZxpFOSOFK03fVNWFPEt8nU= Received: from BL1PR13CA0165.namprd13.prod.outlook.com (2603:10b6:208:2bd::20) by MW4PR02MB7364.namprd02.prod.outlook.com (2603:10b6:303:64::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Fri, 22 Jan 2021 00:18:58 +0000 Received: from BL2NAM02FT024.eop-nam02.prod.protection.outlook.com (2603:10b6:208:2bd:cafe::5) by BL1PR13CA0165.outlook.office365.com (2603:10b6:208:2bd::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.7 via Frontend Transport; Fri, 22 Jan 2021 00:18:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BL2NAM02FT024.mail.protection.outlook.com (10.152.77.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 00:18:57 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Thu, 21 Jan 2021 16:18:55 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Thu, 21 Jan 2021 16:18:55 -0800 Received: from [172.19.2.32] (port=58488 helo=xsjkomlodi50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1l2kAB-0001Bj-Ij; Thu, 21 Jan 2021 16:18:55 -0800 From: Joe Komlodi To: Subject: [PATCH v1 2/3] target/microblaze: use MMUAccessType instead of int in mmu_translate Date: Thu, 21 Jan 2021 16:18:54 -0800 Message-ID: <1611274735-303873-3-git-send-email-komlodi@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1611274735-303873-1-git-send-email-komlodi@xilinx.com> References: <1611274735-303873-1-git-send-email-komlodi@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1f182405-a33c-4b67-a11f-08d8be6b4f9d X-MS-TrafficTypeDiagnostic: MW4PR02MB7364: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: irXaeVQvkEvz2xl8H+wtr6EvU2aNOb+n7slmdd8CjjIfRYOwTe5Ms4/NLHnhE9XqMHQZ8VW2yhGzhiUkRSfvAVP6viDzSuC4aahikgmMxu9ZupNkxtDVjmVarlctKlGBsK+kSnNBLg3OQOb9fYU9yb0ZWaLplsmSx53NoPcJ+rFiVidrC0bAanPQIaO27AMNAMlwW1Gz9hpuUYIPcg6wr4EDsDJc097wAxXd0NJLHKdGsq0qaNYi0jGjREy0NbW5ehN//6deVOlDbRNctssx7/s/vhIP/bSm9GaT2meWozWP3X/tBuqqUrtWeJwLcNYtWZPSZMqzZ5Q8+HHW9Iu1MyEilt33PbeTctVkysPVmysHC3FijpYowhXESmLUuYw1XaIyJdrHd88xYuoOCJx6bs5lKrslqIg5R72TouOEtlTNrx99TrfcAV5B5PcJ3hH8Vy+oAKYrZajwBVdfOXqxo2yIBwHUwRiUWrlYzF3JBYmZywTJKctZWcLlsXAhkWRE X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39860400002)(396003)(376002)(346002)(136003)(46966006)(5660300002)(9786002)(6916009)(26005)(8936002)(47076005)(186003)(82740400003)(356005)(70586007)(70206006)(36756003)(2906002)(7636003)(478600001)(36906005)(316002)(2616005)(107886003)(336012)(86362001)(44832011)(7696005)(8676002)(82310400003)(426003)(4326008)(83380400001)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 00:18:57.8004 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f182405-a33c-4b67-a11f-08d8be6b4f9d X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BL2NAM02FT024.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR02MB7364 Received-SPF: pass client-ip=40.107.94.50; envelope-from=komlodi@xilinx.com; helo=NAM10-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgari@xilinx.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Using MMUAccessType makes it more clear what the variable's use is. No functional change. Signed-off-by: Joe Komlodi Reviewed-by: Richard Henderson Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias --- target/microblaze/mmu.c | 2 +- target/microblaze/mmu.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/microblaze/mmu.c b/target/microblaze/mmu.c index 1e42696..cc40f27 100644 --- a/target/microblaze/mmu.c +++ b/target/microblaze/mmu.c @@ -74,7 +74,7 @@ static void mmu_change_pid(CPUMBState *env, unsigned int newpid) /* rw - 0 = read, 1 = write, 2 = fetch. */ unsigned int mmu_translate(MicroBlazeCPU *cpu, MicroBlazeMMULookup *lu, - target_ulong vaddr, int rw, int mmu_idx) + target_ulong vaddr, MMUAccessType rw, int mmu_idx) { MicroBlazeMMU *mmu = &cpu->env.mmu; unsigned int i, hit = 0; diff --git a/target/microblaze/mmu.h b/target/microblaze/mmu.h index 09e4075..b6b4b9a 100644 --- a/target/microblaze/mmu.h +++ b/target/microblaze/mmu.h @@ -84,7 +84,7 @@ typedef struct { } MicroBlazeMMULookup; unsigned int mmu_translate(MicroBlazeCPU *cpu, MicroBlazeMMULookup *lu, - target_ulong vaddr, int rw, int mmu_idx); + target_ulong vaddr, MMUAccessType rw, int mmu_idx); uint32_t mmu_read(CPUMBState *env, bool ea, uint32_t rn); void mmu_write(CPUMBState *env, bool ea, uint32_t rn, uint32_t v); void mmu_init(MicroBlazeMMU *mmu); From patchwork Fri Jan 22 00:18:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Komlodi X-Patchwork-Id: 1430146 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-xilinx-onmicrosoft-com header.b=swkRRLZV; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DMKyf4DDKz9s24 for ; Fri, 22 Jan 2021 11:34:34 +1100 (AEDT) Received: from localhost ([::1]:34080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l2kPI-0006vT-He for incoming@patchwork.ozlabs.org; Thu, 21 Jan 2021 19:34:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40280) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2kOs-0006pb-6M for qemu-devel@nongnu.org; Thu, 21 Jan 2021 19:34:06 -0500 Received: from mail-mw2nam12on2075.outbound.protection.outlook.com ([40.107.244.75]:39488 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l2kOp-0007oO-9P for qemu-devel@nongnu.org; Thu, 21 Jan 2021 19:34:05 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FEzV4QMl4gXTEVEmYVekYIFAbTLza5jE6Y9ptu3XhBlgaPUGpgUG4+mGUe8Snggnr1UUv4f9cbOykhUY7dR2gAjfvcJEdlqB+LGrwvd/VO2608h7J65imdIkRHi79Zang5u3OGKgOmnB7nH57eB0gqslonMrjlJF4d6fkhu7p2GjNWNz/rxGQriSEzUGFToxmMPk2idi0vncu3YPKiyu9ha05udZ7RSXUK0W6ysKqE0WGDOHcAPOz+uy17msflo/Kqgc/EBLPKDUnDDgXucA+Lwr4pm7f/SYyII7WCT/TQNRgspZbS8j+8wMVGXTdMKeaHfxVDqISsvf6+kITWGpqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OBk+4u7QNRo+XKfEL4VEtXOozOvTrVZrWBBtiJSR2WA=; b=nsH7T+vYVn8F5qs35owRxNZHzGRrpujrPdiq85zb6bl98ltoNqbHZCQ+8hkDLvY9YPD5mw6YfTfoykVDJqghWuthJaYhVpdvrPN7pEj/61OrzoYiExwSdDCH1hdx1WUtuxqo0pfaDEtbHTW/m6Vsz0Yola7x23vcVceicCLc5i+7ljfJpsZj3W1j6nZDKwf0TGnmSUlIXJ6u/jqLJ5wBQL76hiQxla3NA3l+l+zFDQeLHBjfalOZpTyk0UaJbEBGah9odL91hiQzFwSTSWh3G7fSHG8vGGKQuBqXaQgnTWDEyAi1DmxjhNkpR2coaOnksWlMQAg8YKw6lhMr9qSoYg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=nongnu.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OBk+4u7QNRo+XKfEL4VEtXOozOvTrVZrWBBtiJSR2WA=; b=swkRRLZVGCCqk1UpUayBAxz3gEeGBNtSXD8dxMnPQONcXR8ho1urx2NJOswLKbh2autketO8FLMTqiNpDhIvcIw3fyfi1mZF0wHni7+79/oZWCSVCAT0g1mvJyCzRyU8HFDZPDgpDCwcP5xk96JvuJBSuP0elFCNs/HZmWAmcLg= Received: from BL1PR13CA0157.namprd13.prod.outlook.com (2603:10b6:208:2bd::12) by PH0PR02MB7463.namprd02.prod.outlook.com (2603:10b6:510:15::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Fri, 22 Jan 2021 00:18:58 +0000 Received: from BL2NAM02FT024.eop-nam02.prod.protection.outlook.com (2603:10b6:208:2bd:cafe::6a) by BL1PR13CA0157.outlook.office365.com (2603:10b6:208:2bd::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3805.6 via Frontend Transport; Fri, 22 Jan 2021 00:18:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by BL2NAM02FT024.mail.protection.outlook.com (10.152.77.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3784.12 via Frontend Transport; Fri, 22 Jan 2021 00:18:58 +0000 Received: from xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Thu, 21 Jan 2021 16:18:55 -0800 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Thu, 21 Jan 2021 16:18:55 -0800 Received: from [172.19.2.32] (port=58488 helo=xsjkomlodi50.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1l2kAB-0001Bj-JC; Thu, 21 Jan 2021 16:18:55 -0800 From: Joe Komlodi To: Subject: [PATCH v1 3/3] target/microblaze: Add security attributes on memory transactions Date: Thu, 21 Jan 2021 16:18:55 -0800 Message-ID: <1611274735-303873-4-git-send-email-komlodi@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1611274735-303873-1-git-send-email-komlodi@xilinx.com> References: <1611274735-303873-1-git-send-email-komlodi@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a9bb3a2-458d-4505-75eb-08d8be6b5009 X-MS-TrafficTypeDiagnostic: PH0PR02MB7463: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2512; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Qe1m6P5vGwNFg8el9wCMlfXmvVzPf61YmPSGOIa59cVHA8JgeJ90l+tkoEtFmoJWjcMD+a9VrOlbYPsCC+kjO7kC8jCOUfJzreROtas9KN3sMs8dDJBxfQlLM1GNUlscafLwI764LVOGdEAcCocgqypDviQy1v4KAY9TlTusH+dsSExI8mhaFu2hh8zWV+rwbJ3DAgDTnU4jumTUN14uwvGhyWADUKDvux/YXoSsaEzaDMljtMPKYhmk+efrQ2q75uqqiyFi5jmt1j5voaur6Ok1Van3IK4/zadHxkDLVdFd+ToWtBOOp/1V2LKevEw0kJM6e9Fp7pk4jeq+5hnWL0vzabfARx7bhTFzSwSGJjYxoZ5inO0odPSWPGjeef0w4hR4jwHoyjid+rHzPuaFDYH5rWLpb3w/33fBTEMA46ZPdZ4R4wnUps7PhDWdrLsOofESm1CXPhDmbxhSM2YR8CLS5Zbq0Hq/xvsgv/deszWdsw+GYBMOE07DtR8DQoTi X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(396003)(346002)(136003)(39860400002)(46966006)(316002)(44832011)(186003)(478600001)(4326008)(356005)(86362001)(7696005)(5660300002)(6916009)(2616005)(36906005)(2906002)(8676002)(82740400003)(83380400001)(7636003)(26005)(336012)(70586007)(82310400003)(8936002)(70206006)(107886003)(9786002)(36756003)(47076005)(426003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2021 00:18:58.5091 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a9bb3a2-458d-4505-75eb-08d8be6b5009 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: BL2NAM02FT024.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR02MB7463 Received-SPF: pass client-ip=40.107.244.75; envelope-from=komlodi@xilinx.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: edgari@xilinx.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Using the cfg.use_non_secure bitfield and the MMU access type, we can determine if the access should be secure or not. Signed-off-by: Joe Komlodi Reviewed-by: Edgar E. Iglesias Tested-by: Edgar E. Iglesias --- target/microblaze/cpu.c | 2 +- target/microblaze/cpu.h | 3 ++- target/microblaze/helper.c | 26 +++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c index accfb23..d5e8bfe 100644 --- a/target/microblaze/cpu.c +++ b/target/microblaze/cpu.c @@ -375,7 +375,7 @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) cc->tlb_fill = mb_cpu_tlb_fill; #ifndef CONFIG_USER_ONLY cc->do_transaction_failed = mb_cpu_transaction_failed; - cc->get_phys_page_debug = mb_cpu_get_phys_page_debug; + cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug; dc->vmsd = &vmstate_mb_cpu; #endif device_class_set_props(dc, mb_properties); diff --git a/target/microblaze/cpu.h b/target/microblaze/cpu.h index 199cfb0..e4bba8a 100644 --- a/target/microblaze/cpu.h +++ b/target/microblaze/cpu.h @@ -361,7 +361,8 @@ void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr, MMUAccessType access_type, int mmu_idx, uintptr_t retaddr); void mb_cpu_dump_state(CPUState *cpu, FILE *f, int flags); -hwaddr mb_cpu_get_phys_page_debug(CPUState *cpu, vaddr addr); +hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr, + MemTxAttrs *attrs); int mb_cpu_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg); int mb_cpu_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg); diff --git a/target/microblaze/helper.c b/target/microblaze/helper.c index cda14a1..20dbd67 100644 --- a/target/microblaze/helper.c +++ b/target/microblaze/helper.c @@ -46,6 +46,16 @@ bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size, #else /* !CONFIG_USER_ONLY */ +static bool mb_cpu_access_is_secure(MicroBlazeCPU *cpu, + MMUAccessType access_type) +{ + if (access_type == MMU_INST_FETCH) { + return !cpu->ns_axi_ip; + } else { + return !cpu->ns_axi_dp; + } +} + bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MMUAccessType access_type, int mmu_idx, bool probe, uintptr_t retaddr) @@ -55,12 +65,16 @@ bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size, MicroBlazeMMULookup lu; unsigned int hit; int prot; + MemTxAttrs attrs = {}; + + attrs.secure = mb_cpu_access_is_secure(cpu, access_type); if (mmu_idx == MMU_NOMMU_IDX) { /* MMU disabled or not available. */ address &= TARGET_PAGE_MASK; prot = PAGE_BITS; - tlb_set_page(cs, address, address, prot, mmu_idx, TARGET_PAGE_SIZE); + tlb_set_page_with_attrs(cs, address, address, attrs, prot, mmu_idx, + TARGET_PAGE_SIZE); return true; } @@ -71,7 +85,8 @@ bool mb_cpu_tlb_fill(CPUState *cs, vaddr address, int size, qemu_log_mask(CPU_LOG_MMU, "MMU map mmu=%d v=%x p=%x prot=%x\n", mmu_idx, vaddr, paddr, lu.prot); - tlb_set_page(cs, vaddr, paddr, lu.prot, mmu_idx, TARGET_PAGE_SIZE); + tlb_set_page_with_attrs(cs, vaddr, paddr, attrs, lu.prot, mmu_idx, + TARGET_PAGE_SIZE); return true; } @@ -230,7 +245,8 @@ void mb_cpu_do_interrupt(CPUState *cs) } } -hwaddr mb_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) +hwaddr mb_cpu_get_phys_page_attrs_debug(CPUState *cs, vaddr addr, + MemTxAttrs *attrs) { MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs); CPUMBState *env = &cpu->env; @@ -239,6 +255,10 @@ hwaddr mb_cpu_get_phys_page_debug(CPUState *cs, vaddr addr) int mmu_idx = cpu_mmu_index(env, false); unsigned int hit; + /* Caller doesn't initialize */ + *attrs = (MemTxAttrs) {}; + attrs->secure = mb_cpu_access_is_secure(cpu, MMU_DATA_LOAD); + if (mmu_idx != MMU_NOMMU_IDX) { hit = mmu_translate(cpu, &lu, addr, 0, 0); if (hit) {