From patchwork Fri Jul 7 11:30:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 13304814 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D43C5EB64DA for ; Fri, 7 Jul 2023 11:46:24 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHjgs-00026n-Us; Fri, 07 Jul 2023 07:31:58 -0400 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 1qHjgr-000252-1Y; Fri, 07 Jul 2023 07:31:57 -0400 Received: from mail-oa1-x2a.google.com ([2001:4860:4864:20::2a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qHjgn-0006ZL-GG; Fri, 07 Jul 2023 07:31:56 -0400 Received: by mail-oa1-x2a.google.com with SMTP id 586e51a60fabf-1b06da65bdbso1655525fac.1; Fri, 07 Jul 2023 04:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688729511; x=1691321511; 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=uviHD+0LDa2GE+uG7Tg16v52aSEimIm9yJJ2mi2M4+0=; b=FSB36f3/cMW3c+DpKFaEmu407KXDTA9oYKvCqE4tC1fRZ3RTGQ0+NTfLYjzRJV5NPA USH6uLaexsSLS4C0ibbO+4rL94vaH6PP7wUzg/YC6+ZONRZv6c0PqiAwp4/9flcxqAQk RPD2qMw53RPpgAk1Qd7OtpIdZ0lgxWz/jK3AKsnNaezih4bqqEOxoixSu3XTeqyDoy1z HgCFgo7K2zIAHizJ/fATnzXitppuewIlpadBnUP+BrPSJgll2IyS2M4wlWghGt08YY7e 3B8uJy4kbk1W9CCU6JdKpXCsG8z71oU0SSaM05kCG2ug0L/pS3lkontEwrMj61hmjnHm dGfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688729511; x=1691321511; 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=uviHD+0LDa2GE+uG7Tg16v52aSEimIm9yJJ2mi2M4+0=; b=CcipYH9UbfdQjw70AOTMdePd6WLSw2Hu2Dz36VGIN62mh145rQPeknE/xOsDRwYh4i 6ndipmlNrSq3EgerOpxG7xTNdiTjTXrz0KASqSiS3A+wUGIilMAemIqjyLUf1T/zyR2N NSJ+UztNeEg8YCPQLJUxSpxiGeAqigZl/UJ2EB40vcLB5Q1S9Hh/ZMS9mIHnHYYf6iss DVjQyNPnuYFc3nQdXs4U2pfnW7FBZiBjUwAVRsvCMXZTC6X+BUNdUvOecv/ZB3KjPrlo k8pjG8RBxFsapdN7n1ppGIOK+D/LEk/RSwKvQG971goFjE4nb78c95Nrt4TH8WJtMkqU Kw4A== X-Gm-Message-State: ABy/qLYKG5w3Qs6sGZMwVEeMInbmnijuAh+TYn02Ql3uBy75U8RstpKW syIJ2iZBKRZHPyjhPrzzgynO2ZjbHC8= X-Google-Smtp-Source: APBJJlHCmid8NfzEv/O5PUAu+adXCtQ/0KnQOOD+VIkRINVk6zW/C0XllXUnKQBD5hx7ndaFst7I0Q== X-Received: by 2002:a05:6871:60f:b0:1b0:3b98:50e4 with SMTP id w15-20020a056871060f00b001b03b9850e4mr5426829oan.58.1688729511114; Fri, 07 Jul 2023 04:31:51 -0700 (PDT) Received: from grind.. ([2804:14c:f435:9162::1002]) by smtp.gmail.com with ESMTPSA id g17-20020a9d6c51000000b006b74b37f5e5sm1574859otq.20.2023.07.07.04.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jul 2023 04:31:50 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, danielhb413@gmail.com, peter.maydell@linaro.org, richard.henderson@linaro.org, Frederic Barrat , Nicholas Piggin , =?utf-8?q?C=C3=A9dric_Le_Goater?= Subject: [PULL 11/60] pnv/xive2: Allow indirect TIMA accesses of all sizes Date: Fri, 7 Jul 2023 08:30:19 -0300 Message-ID: <20230707113108.7145-12-danielhb413@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230707113108.7145-1-danielhb413@gmail.com> References: <20230707113108.7145-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2a; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2a.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org From: Frederic Barrat Booting linux on the powernv10 machine logs a few errors like: Invalid read at addr 0x38, size 1, region 'xive-ic-tm-indirect', reason: invalid size (min:8 max:8) Invalid write at addr 0x38, size 1, region 'xive-ic-tm-indirect', reason: invalid size (min:8 max:8) Invalid read at addr 0x38, size 1, region 'xive-ic-tm-indirect', reason: invalid size (min:8 max:8) Those errors happen when linux is resetting XIVE. We're trying to read/write the enablement bit for the hardware context and qemu doesn't allow indirect TIMA accesses of less than 8 bytes. Direct TIMA access can go through though, as well as indirect TIMA accesses on P9. So even though there are some restrictions regarding the address/size combinations for TIMA access, the example above is perfectly valid. This patch lets indirect TIMA accesses of all sizes go through. The special operations will be intercepted and the default "raw" handlers will pick up all other requests and complain about invalid sizes as appropriate. Tested-by: Nicholas Piggin Signed-off-by: Frederic Barrat Reviewed-by: Cédric Le Goater Message-ID: <20230626094057.1192473-1-fbarrat@linux.ibm.com> Signed-off-by: Daniel Henrique Barboza --- hw/intc/pnv_xive2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/pnv_xive2.c b/hw/intc/pnv_xive2.c index ed438a20ed..e8ab176de6 100644 --- a/hw/intc/pnv_xive2.c +++ b/hw/intc/pnv_xive2.c @@ -1644,11 +1644,11 @@ static const MemoryRegionOps pnv_xive2_ic_tm_indirect_ops = { .write = pnv_xive2_ic_tm_indirect_write, .endianness = DEVICE_BIG_ENDIAN, .valid = { - .min_access_size = 8, + .min_access_size = 1, .max_access_size = 8, }, .impl = { - .min_access_size = 8, + .min_access_size = 1, .max_access_size = 8, }, };