From patchwork Thu Jun 27 15:19:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Palmer Dabbelt X-Patchwork-Id: 11020019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 16F8076 for ; Thu, 27 Jun 2019 16:00:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06C2628434 for ; Thu, 27 Jun 2019 16:00:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF0232846C; Thu, 27 Jun 2019 16:00:14 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7FD6328434 for ; Thu, 27 Jun 2019 16:00:14 +0000 (UTC) Received: from localhost ([::1]:52036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgWon-0003NF-P8 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 27 Jun 2019 12:00:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33010) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgWHW-0003A1-P3 for qemu-devel@nongnu.org; Thu, 27 Jun 2019 11:25:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgWHU-00005B-I7 for qemu-devel@nongnu.org; Thu, 27 Jun 2019 11:25:50 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39100) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hgWHT-0006l2-Ff for qemu-devel@nongnu.org; Thu, 27 Jun 2019 11:25:47 -0400 Received: by mail-pl1-f193.google.com with SMTP id b7so1484209pls.6 for ; Thu, 27 Jun 2019 08:23:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:cc:from:to; bh=EKsqQug7v7zszsNqo0b9Js3bl54LND9OiSrVub9vLW4=; b=G+ww913SqskSV/csvNAEWyObTKRHgWt/6gIAwrOoAfBPQfwuPYj9Y4K77134dMRjg8 q6KMxVqLonZm6EBVrmu8NbPXcgnAR8Gc+SHLJh5cbTs06iKkE+fQ9Ng8p3CtwWRG93nQ JUU3mKBB8CabWapVcYeIuaE3Xn/d5NIHGneEyfoNeQTyzNzMXs41wK+8U875l+8SXyUO /qPY6zEN+UtH73G9jgYi5Xy2SP4VVXWS9n9HDXqrPp5yhCtNNGN6xovXmXvWhBV7/Ky5 2ADlB8zCEDjBtnsd8WMEFYgegxlOMnA+66qVUbv357TydXltf6YyZ3fVWDMovXMVH62s vxBA== X-Gm-Message-State: APjAAAX3rWqvywLnKO6RGvfhwwmzAJBbm0sfcNqHTetRpqIs9LrG1c2Q UL8D+m9rnPXNv6uaGzMVkv/qNg== X-Google-Smtp-Source: APXvYqyRMQg2H4LjYcqHOJbejMMN+hBHC7SOa/P/+uW0VsKzuXmE5DIcEDTPnnw01BoTEWHqExXJ+A== X-Received: by 2002:a17:902:a517:: with SMTP id s23mr5262268plq.306.1561649026947; Thu, 27 Jun 2019 08:23:46 -0700 (PDT) Received: from localhost (220-132-236-182.HINET-IP.hinet.net. [220.132.236.182]) by smtp.gmail.com with ESMTPSA id o14sm5045356pjp.29.2019.06.27.08.23.46 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 08:23:46 -0700 (PDT) Date: Thu, 27 Jun 2019 08:19:47 -0700 Message-Id: <20190627152011.18686-11-palmer@sifive.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190627152011.18686-1-palmer@sifive.com> References: <20190627152011.18686-1-palmer@sifive.com> MIME-Version: 1.0 From: Palmer Dabbelt To: Peter Maydell X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.214.193 Subject: [Qemu-devel] [PULL 10/34] RISC-V: Fix a PMP check with the correct access size 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: Alistair Francis , Palmer Dabbelt , qemu-riscv@nongnu.org, qemu-devel@nongnu.org, Hesham Almatary Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Hesham Almatary The PMP check should be of the memory access size rather than TARGET_PAGE_SIZE. Signed-off-by: Hesham Almatary Reviewed-by: Alistair Francis Signed-off-by: Palmer Dabbelt --- target/riscv/cpu_helper.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c index 66be83210f11..e1b079e69c60 100644 --- a/target/riscv/cpu_helper.c +++ b/target/riscv/cpu_helper.c @@ -452,8 +452,7 @@ bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size, if (riscv_feature(env, RISCV_FEATURE_PMP) && (ret == TRANSLATE_SUCCESS) && - !pmp_hart_has_privs(env, pa, TARGET_PAGE_SIZE, 1 << access_type, - mode)) { + !pmp_hart_has_privs(env, pa, size, 1 << access_type, mode)) { ret = TRANSLATE_PMP_FAIL; } if (ret == TRANSLATE_PMP_FAIL) {