From patchwork Tue Jul 26 18:23:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 593462 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:b811:0:0:0:0 with SMTP id fc17csp3779317mab; Tue, 26 Jul 2022 11:29:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tw2p306ofyBascFMwuuQIZ0EHtHbZuGrmS63p33jli3Cx0dWCu8dDd0xPKureONg9+3S8v X-Received: by 2002:a05:620a:712:b0:6b5:d977:bebb with SMTP id 18-20020a05620a071200b006b5d977bebbmr13736004qkc.552.1658860159231; Tue, 26 Jul 2022 11:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658860159; cv=none; d=google.com; s=arc-20160816; b=aTttxy0OWpLvqwPoNvrs9gDDrIf3OxxFDnZn3M8pH2/ZX5eaFSldyhQ0lbEHSeBKhi Br8pneBJyMPnPmMyoCLAhGuV6YH2J9u4yP/esKeaOPAWAxo+kBhzIqskZviHr5su/+HN FDaECPK4rsm3lUYnaOBJp2ed8++rWmS1/PoceInhQXnrXcrWaU5W6ELGbNRvWvj5TyPZ y4mqqXeUcM89wquw8JpZwnWQOE8Ys0z5dOIvrEH700jBbZyQdr+mdH/tyHCCcy08vNSR F8n5NjrGFaFK2S26X/GlA5hM3yGfcSl1Wdj6ETB0dzZJ6Pz/WYie7SbUkATU4hAP3UXe DPyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Q3wRM0mYTsBHQhTgGrkSqDwGFdrtiUjwZJz6kElPnj8=; b=bBsLkjc9swgeLQOpZ0C4U1TwnKXgekeBLkp171r7i7L+4LJh4wE+ZQS7bMVhrI89i+ 3UhgucRnu/5plTeF9y65g5QmNqZw90eLzmYDUtVKZqgebFsx3SnmS7qFoJf4JL+oWxOq ra+chLbYRiHxkxkzUz4Ey/hLOJKXIMDwO2U6mdvfurdHXTfCkuHYMRH7Rashwa6NEJd1 vpKLCBMhYi2bGAawlC3bUhiEqIpso2L9bfaCzuOF+6H0EDi+HpBo49aKngkm+tGr6smg jLD1UmN4PQENILSsoh8K5qFwNfHQ20RCxzq6hErBHkrxcwmVPFFh/zPw/L3s5Q30dsFR q4Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WeltduiB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d18-20020a05620a137200b006b563ad49b3si8095466qkl.275.2022.07.26.11.29.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Jul 2022 11:29:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WeltduiB; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oGPJ0-0005Na-Rw for patch@linaro.org; Tue, 26 Jul 2022 14:29:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGPDh-00013s-9Z for qemu-devel@nongnu.org; Tue, 26 Jul 2022 14:23:49 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:43623) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGPDe-0001dW-Ef for qemu-devel@nongnu.org; Tue, 26 Jul 2022 14:23:47 -0400 Received: by mail-wr1-x432.google.com with SMTP id v17so2343682wrr.10 for ; Tue, 26 Jul 2022 11:23:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Q3wRM0mYTsBHQhTgGrkSqDwGFdrtiUjwZJz6kElPnj8=; b=WeltduiBaletKGgtO3lnBR+GpLm6wvkJ4wSb475GkcQDGjZ2Av0waKab2SX9lmR2Y1 Qnti0EU3JyWbwrF0us3SqwfazJBbG0Wt9UCOCk2gNq9T9RluR4dzgaMMi5XFxhTT10Kw COMwBlOnPEn60tqCmCn/MwN5IfjGw5hxizvGs4K1nvFxP1Mbhav0xfWKxoWxQ7fAKq0i syB29I1BMzD0hNWuci6bXC55Dzn127fOwxXwOXGnLO/C1PnFEunZfA0ev4/01leX2nJY /R4hu3/zVlhIceDaa4ZpnhAevsZIqTKdhicgcKUvmcbxRShaSj7L9w7YrPbCVL7y9XWA KWEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Q3wRM0mYTsBHQhTgGrkSqDwGFdrtiUjwZJz6kElPnj8=; b=sHmxnHhi+8ErrhNnX6jK//1eaCPvqyBVFoJ3bmY23YnFUvbUr72JPqs4cg9l9M4ca2 VHp+Zz0fRTClikcGyMjexo6gvi/E53ILg1v4f+2bHLyZvbGanGS4I6KzYU7C0Ml+Nlad rj6bk9i+Z4JG0YhwDaSSd10JocjOl4gdpMWFuaCI0ZXIXCSC1X5fOXxtU5AJyKbXoNMM DVJZY2NzQ1pkgZBW4wA5i9FT2iIVbjtmXQ12f/mzFhup1nxWx8MbpOPNm57vMWJW3LQ+ NijJPtz3yUtuNGXwim/IV5qkfAeLqHAIw5CiU4mUYzNw1MFfw8cCq10aAKaGQIAeVR4L 2XLA== X-Gm-Message-State: AJIora9pI1QX+LfmJH2kUqIoCKU8NZMowb7eAfNL+Z2ode+zMgvNfnnk lWi3K6gpmlIqOYt2fqUnc5oWOWwr1h+w1g== X-Received: by 2002:a5d:4e41:0:b0:21e:88f9:84be with SMTP id r1-20020a5d4e41000000b0021e88f984bemr7242462wrt.67.1658859824537; Tue, 26 Jul 2022 11:23:44 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id f5-20020adff445000000b0021e5f32ade7sm11725343wrp.68.2022.07.26.11.23.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 11:23:44 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, BALATON Zoltan , Daniel Henrique Barboza , =?utf-8?q?C=C3=A9dric_Le_G?= =?utf-8?q?oater?= Subject: [RFC 0/2] Fix Coverity and other errors in ppc440_uc DMA Date: Tue, 26 Jul 2022 19:23:39 +0100 Message-Id: <20220726182341.1888115-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This patchset is mainly trying to fix a problem that Coverity spotted in the dcr_write_dma() function in hw/ppc/ppc440_uc.c, where the code is not correctly using the cpu_physical_memory_map() function. While I was fixing that I noticed a second problem in this code, where it doesn't have a fallback for when cpu_physical_memory_map() says "I couldn't map that for you". I've marked these patches as RFC, partly because I don't have any guest that would exercise the code changes[*], and partly because I don't have any documentation of the hardware to tell me how it should behave, so patch 2 in particular has some FIXMEs. I also notice that the code doesn't update any of the registers like the count or source/base addresses when the DMA transfer happens, which seems odd, but perhaps the real hardware does work like that. I think we should probably take patch 1 (which is a fairly minimal fix of the use-of-uninitialized-data problem), but patch 2 is a bit more unfinished. [*] The commit 3c409c1927efde2fc that added this code says it's used by AmigaOS.) thanks -- PMM Peter Maydell (2): hw/ppc/ppc440_uc: Initialize length passed to cpu_physical_memory_map() hw/ppc/ppc440_uc: Handle mapping failure in DMA engine hw/ppc/ppc440_uc.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) Tested-by: BALATON Zoltan