From nobody Thu Nov 14 07:13:45 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1704877625; cv=none; d=zohomail.com; s=zohoarc; b=P3oRl3uDJnpn8pClUJOvRBsL5+tlNwLfFOARxxAwSHUW7PaNlXBoNn41vtSCxAfl7HyC+W4GBD8L3nG2T7FdtK1/crPSVI9Cuo1SATDVo9kGF9Iw21YBORDu37m76jBWd8eiRBpX3RlSjeDhG/8jVaXSnXA96ypkWDdjwB5ZjFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704877625; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=3DZmZome8pfz6x3O6MtIJon1jDru9oEpFPjmaR3Dens=; b=Iaa90zJCAKWuZzySgV9WNUKNHSV2Iq/F4pyGYPZdiemXIrLIlXWBBHZgtwK0v/G8+KnG0nlQ9ghe5WvwSZa7GhsC50wfVKzn7Xn1IY32C9iNp4i0X2OxYxvim3HxrueR+dM54ZqpNp9sgYw0WS8nsyEgWVTzxfDoH89sY6RbCaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1704877625792158.53529680816905; Wed, 10 Jan 2024 01:07:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rNUUC-0004yv-Vf; Wed, 10 Jan 2024 04:02:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rNUT1-0003Tc-Q7 for qemu-devel@nongnu.org; Wed, 10 Jan 2024 04:01:46 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rNUSy-0005fk-S1 for qemu-devel@nongnu.org; Wed, 10 Jan 2024 04:01:42 -0500 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6d9b5c4f332so2084043b3a.3 for ; Wed, 10 Jan 2024 01:01:39 -0800 (PST) Received: from toolbox.alistair23.me (2403-580b-97e8-0-321-6fb2-58f1-a1b1.ip6.aussiebb.net. [2403:580b:97e8:0:321:6fb2:58f1:a1b1]) by smtp.gmail.com with ESMTPSA id t65-20020a628144000000b006d9879ba6besm3223814pfd.170.2024.01.10.01.01.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 01:01:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704877299; x=1705482099; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3DZmZome8pfz6x3O6MtIJon1jDru9oEpFPjmaR3Dens=; b=UC1XQj93Sid3HSW3gor7X8Ee7H0Um0rHbmfgEWawovVmnULUDSMiz92fokZ/ssxHga 4Ht4xFJg0rcCZy22JdVL2InNCr8Z6piZ6anas1UnuEGxAgKc/3yRk/nATvO6wckLI+ut O/O92sZ0L3AfUCgqad+H7XmunVrJqwZjJ4aVVWsmsrGrDqGsFxTKUsTRQXWZ66+aJ5z5 Ghah2eeujgoBL1uQb8sLLCQDlclvko+s/wZr2P/cxzMgnqx16mzVbqQLV2dV9EfmQQww ayILTay2iQOBCZyngyikIFLBwuegns2ICx8+VjJVMm7LjpvxXfx6iiS9cNqpKRrPvH8G 2Kdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704877299; x=1705482099; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3DZmZome8pfz6x3O6MtIJon1jDru9oEpFPjmaR3Dens=; b=YSqj9Ht+wRVospcDSyvoz5UWoVIGyzg97nWbvGXJYI80UbO1qDul5DhA8PIJcFWl4K uW1JyYpyEu2jZgdX9y57vs9gDoAGf4W4xHxCq6mBMyFzzewvnKmA5LxmSv3MmS9E+0at yk39oUVGdg7RzLO0jAB60y3FaT3T2GLyvRXGRP7rEvkkvG95sYN9DdaFIRO5zN3JtX+6 m8Hk1FbuJjH5hWSV4ZtR4MSE1fNAWKBEazKFW42KIi1CY8vJ2EdDlo6CNY5h02xzekge lqkUk9UfNr3LX9crzN93s3gZ7EHQy3MJc9YdeXQcWe4bBhTA5GQbf/fM1KWF0TqgYCVA 385A== X-Gm-Message-State: AOJu0YxhCgq6S3w/ySmlM2Z9S1oD9nsCdQl18S6SLaXxcfhZlLzh1lid Y+VNtOxCXS9IH9kYZrM7ZvGwk2ixqXxjUjLC X-Google-Smtp-Source: AGHT+IEzC1kgCeYF96BlVUQUkvzbJGCuM8aPHqUX4HGFeNLOIkJwTXZ+PmJHZv0NCnNQT7fyNBThGw== X-Received: by 2002:a05:6a00:23d4:b0:6d9:acc8:a326 with SMTP id g20-20020a056a0023d400b006d9acc8a326mr619891pfc.8.1704877298353; Wed, 10 Jan 2024 01:01:38 -0800 (PST) From: Alistair Francis X-Google-Original-From: Alistair Francis To: qemu-devel@nongnu.org Cc: alistair23@gmail.com, Ivan Klokov , Daniel Henrique Barboza , Alistair Francis Subject: [PULL 62/65] target/riscv: pmp: Ignore writes when RW=01 and MML=0 Date: Wed, 10 Jan 2024 18:57:30 +1000 Message-ID: <20240110085733.1607526-63-alistair.francis@wdc.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240110085733.1607526-1-alistair.francis@wdc.com> References: <20240110085733.1607526-1-alistair.francis@wdc.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=alistair23@gmail.com; helo=mail-pf1-x42e.google.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, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1704877626795100001 Content-Type: text/plain; charset="utf-8" From: Ivan Klokov This patch changes behavior on writing RW=3D01 to pmpcfg with MML=3D0. RWX filed is form of collective WARL with the combination of pmpcfg.RW=3D01 remains reserved for future standard use. According to definition of WARL writing the CSR has no other side effect. But current implementation change architectural state and change system behavior. After writing we will get unreadable-unwriteble region regardless on the previous state. On the other side WARL said that we should read legal value and nothing says about what we should write. Current behavior change system state regardless of whether we read this register or not. Fixes: ac66f2f0 ("target/riscv: pmp: Ignore writes when RW=3D01") Signed-off-by: Ivan Klokov Reviewed-by: Daniel Henrique Barboza Reviewed-by: Alistair Francis Message-ID: <20231220153205.11072-1-ivan.klokov@syntacore.com> Signed-off-by: Alistair Francis --- target/riscv/pmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c index dff9512c3f..2a76b611a0 100644 --- a/target/riscv/pmp.c +++ b/target/riscv/pmp.c @@ -126,7 +126,7 @@ static bool pmp_write_cfg(CPURISCVState *env, uint32_t = pmp_index, uint8_t val) /* If !mseccfg.MML then ignore writes with encoding RW=3D01 */ if ((val & PMP_WRITE) && !(val & PMP_READ) && !MSECCFG_MML_ISSET(env)) { - val &=3D ~(PMP_WRITE | PMP_READ); + return false; } env->pmp_state.pmp[pmp_index].cfg_reg =3D val; pmp_update_rule_addr(env, pmp_index); --=20 2.43.0