From patchwork Fri Jan 15 20:11:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 363753 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp171685jap; Fri, 15 Jan 2021 12:12:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJw24HypSbzlBNHOijSLvsHp1FOx3mRMohegfLSUK7JE+wPhw0Px+eT/z+Iq+9tguqKwUS8P X-Received: by 2002:a25:d644:: with SMTP id n65mr16091161ybg.55.1610741561634; Fri, 15 Jan 2021 12:12:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610741561; cv=none; d=google.com; s=arc-20160816; b=F0KepFsXa7bAdiVfUqptB8yOj7duSPGMSITLCzfimoJTw14DeHdFddx3xCBg0QAYIi RM5TiSZPKCI8S6UtrNh0efby2hz59xJw5ZEytv2uv7Oz3phGx9QP/wI5lJeLzTfgES4a lQu7HBOLz8SUV/sLXPDuhRLKRSPKQWfMZITwb9qyO/opyc6mZnldhYAX6DFAPfRXdDAZ hVwXRezLwYFQixqCpJCKhFnEsB1EojueRPqzY19qxAbpMsbZ4k3pIO+zNArS4n1ME22W l8Cvdbeb+TKFZSGIVQOu4yZyveeZUtDTTgN7dbS9LHQQG9/t06BpgZM38PNrVlghqVCx bI0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature; bh=gHZex6k8GCxXaOqT1PzH/6qShyOWhxu7bFY/0WSaBrs=; b=QV6YdDsOcB+GnN4s5Yk8knDzE7dR5f+I326KNKV14VNsal6+vksD14E28NDx0Dc40Z myRr1sKdkyzLkw71pzLk//pKL/FZjwu1xR4var+FLMGvvwYlnbqrWnEplogM3RrNe3YU wIwpnTYR3am6hlfSL5tE5rSv5frThZZhqvegq60f6SWGgQc5G/3JDZoVtT1lrjGhEO5Y /5DWoJuyAX+hKQ7hM8PIkMFpLJkfDWsMQN5ybepd6UNmsEXevGXjQrEeZsuRtdiHXAsN m6VAiamFGpOCZA2KQ33tb03DQNs8QXKpGp2GzNK1wJ6x18swApKLpaG4EGjQTjs3e0Ui UdlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ENIT1wjH; 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 m137si10038785ybm.301.2021.01.15.12.12.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Jan 2021 12:12:41 -0800 (PST) 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=ENIT1wjH; 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]:48696 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l0VSY-0005lf-EB for patch@linaro.org; Fri, 15 Jan 2021 15:12:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47576) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l0VS9-0005l2-5q for qemu-devel@nongnu.org; Fri, 15 Jan 2021 15:12:13 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:36103) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l0VS7-0008Eo-DF for qemu-devel@nongnu.org; Fri, 15 Jan 2021 15:12:12 -0500 Received: by mail-wm1-x330.google.com with SMTP id v184so4428858wma.1 for ; Fri, 15 Jan 2021 12:12:10 -0800 (PST) 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=gHZex6k8GCxXaOqT1PzH/6qShyOWhxu7bFY/0WSaBrs=; b=ENIT1wjH1cU5tSkWG4LK6gY5vuSJBVYXpcTw+SHY0+Dp9Qz+Z9dgAM+WuOG5GQ/wVc KzOiFD1h4w36VmT3Gr1FkWx6y+8XEoq63Kwb6Gjwl5sSgeXuLY5rIewWIY5Yeo1AgZv9 Rmrc15tSN9/VSKqhCXYizwTv8Pt0AYJesI6ElGX47iWs2nm5OuLWhfOL6JscAK+xQVwf kl9axfz6clFeW3dFUmqP40iwu3cBPirnbaVvLeozwbbXxhQ9KLDUffURCQF/A6zHlk0N olpKGnvECXXEMnqG+Kg3OLYHasFZjHoP+ROp7uqUGuXl7a+kPrJSqXuNtyTdXJd9H7xE /6fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gHZex6k8GCxXaOqT1PzH/6qShyOWhxu7bFY/0WSaBrs=; b=ooMHmlewlAEfbyoBqLUVYk8gsfUGd2Hy4o82fFlTDTjULXc5E66V8W1FXFwE1Sgysg yjzgU+BCOAwj1VNhiQaYwD2ICSJL5GVqZ9y7fx5x0qaXfZUDglFOMwcEKPM5mG2+/jjb X6RRbrMefg5MDhNwIXZcpnOGydlGAnJSZtLRz2txfnmDppJvi8OODxWsyLGs93arOFnm 6lCiXj4n5b9xjSUhBTvD2lGOSuF1UhtrZZy3Yi3ZoR2KFbkJPKl92qdVhHbDNo9XWrAL 1VX9GqTDMuOLknmHh0tnXjueZgs8+mqR8SWIS/zKd5o0UclmyhrPAzh1iNlDe2uBe694 4hXg== X-Gm-Message-State: AOAM532cc8i1iho4s3mOaF7eaR9tUIkoSeayn4f5zl6OsJYadvgWeFmh PONTTlFTvx6TJq5S7QhPdUdvfcuBIHFgDQ== X-Received: by 2002:a7b:c757:: with SMTP id w23mr8631351wmk.135.1610741529118; Fri, 15 Jan 2021 12:12:09 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id b3sm10353807wrn.70.2021.01.15.12.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 12:12:08 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PATCH 00/11] hw/m68k/next-cube: refactor to fix Coverity issue Date: Fri, 15 Jan 2021 20:11:55 +0000 Message-Id: <20210115201206.17347-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::330; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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 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: Thomas Huth , Laurent Vivier Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Currently the next-cube board code open-codes a lot of handling of interrupts and some miscellaneous registers. This series refactors that to move most of it into a proper QOM device. (The main motivation here is to fix the Coverity issue CID 1421962 which is a trivial memory leak of the memory returned by qemu_allocate_irqs().) In the real hardware this functionality seems to be the responsibility of the Peripheral Controller (PC) chip, so we name the device that. To ease review, I structured the change as a sequence of commits: the first commit creates the skeleton of the NeXTPC device with no content, but with a backdoor pointer to the NeXTState machine's state struct. That allows subsequent commits to move parts of the code and still have refactored and non-refactored code using the same struct data fields. Eventually all the code and data fields can be transferred to the new device, and we remove the backdoor pointer. Tested with make check and make check-acceptance (which does have a boot test for the board.) thanks -- PMM Peter Maydell (11): hw/m68k/next-cube: Make next_irq() function static hw/m68k/next-cube: Move register/interrupt functionality into a device hw/m68k/next-cube: Move mmio_ops into NeXTPC device hw/m68k/next-cube: Move scr_ops into NeXTPC device hw/m68k/next-cube: Make next_irq take NeXTPC* as its opaque hw/m68k/next-cube: Move int_status and int_mask to NeXTPC struct hw/m68k/next-cube: Make next_irq GPIO inputs to NEXT_PC device hw/m68k/next-cube: Move rtc into NeXTPC struct hw/m68k/next-cube: Remove unused fields from NeXTState hw/m68k/next-cube: Add vmstate for NeXTPC device hw/m68k/next-cube: Add missing header comment to next-cube.h include/hw/m68k/next-cube.h | 15 ++- hw/m68k/next-cube.c | 238 +++++++++++++++++++++++------------- 2 files changed, 168 insertions(+), 85 deletions(-) -- 2.20.1