From patchwork Mon Feb 13 18:43:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 653207 Delivered-To: patch@linaro.org Received: by 2002:adf:f90f:0:0:0:0:0 with SMTP id b15csp2580607wrr; Mon, 13 Feb 2023 10:44:47 -0800 (PST) X-Google-Smtp-Source: AK7set+O6uWaEcT/jy03yVN4N8fLZmpfP2Xoa+jOEL+4+hfB4W2jwOrVwrGhNTpAy15BdK9Bpxdc X-Received: by 2002:a05:622a:1804:b0:3b1:4a8:4665 with SMTP id t4-20020a05622a180400b003b104a84665mr44255469qtc.62.1676313887438; Mon, 13 Feb 2023 10:44:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676313887; cv=none; d=google.com; s=arc-20160816; b=naAcbGKiUOoiqfy32O3UigghdpN1CvG1D7AZ8OE+hoRFOpWdYHSaVY9s2YCoI/THQA WsIBFvY3WgOwjFKVvozGjBkf4WIzukFro7r+B6vJssoo/y5zNheJ5hxnZ0hzqwn47M7e QB3ov5nzmCxiyRMwYLv38sOFmGDCseR8t7hnseWUx7UmlwJnHW3dkPVIRPlKwN2S7fUY K3i6mux6a5EYJL6sy+9XIAcOBazFl3jLWwBIGazTlhOX1890GG24tbIgj5xE15zQMmxl 8Q41CwYdvDT96nHiUwAcfR4h46/P3UHm9uXMmGKnyL9z9Qc4vV34M2bGHAFpp3CnOjn7 EaZw== 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:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xzELhgE3er5tMNQ9I7jJncHCuwtWilKXAa2ONw84yPk=; b=BMECKd4DwKN//vrGVSqeWpRHXo8jACKo5E00emTyNNxb8OPgvh08pPjtI3sOd+RrNM jNsq0NxiXFTov+xHFnMcbnLiPYZbvPaVhwKu8eZVIhN61YZKrRVV4Aubic+a24c+sxSp 61rBUybNShi5vXRz4dzTyeUlP9t3It4NfTPjUlNDfLOwpCoxtNspnyQs3CZV61tZwK3O Qmpr2PsOAqlEb/9DjCT4dqYbvWbNTUwhxX7SafuveA4dit5Toi8tzQRzK/MPFfy97CWv oKt1/4IczCF51bMevtXgRqyAsnLxVgFy7cryGuTBodvuJwgRXDc7vDY7e6PD+zFrTbGj ss5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=M21viOpH; 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 b4-20020ac87fc4000000b003ba75817499si10502857qtk.242.2023.02.13.10.44.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 13 Feb 2023 10:44:47 -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=M21viOpH; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRdo9-0000y6-Bl; Mon, 13 Feb 2023 13:44:09 -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 1pRdo0-0000tq-U8 for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:01 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRdny-0008P1-BW for qemu-devel@nongnu.org; Mon, 13 Feb 2023 13:44:00 -0500 Received: by mail-wm1-x331.google.com with SMTP id m20-20020a05600c3b1400b003e1e754657aso3520756wms.2 for ; Mon, 13 Feb 2023 10:43:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=xzELhgE3er5tMNQ9I7jJncHCuwtWilKXAa2ONw84yPk=; b=M21viOpHSiCy0/ZKOZq0RXEE4xTGLz5+ydd2Mf8zV77TFadu504ztwdREBGwdgwnW4 IG2/RbyCPcw3K1584adJg5/nAAGdzwFdJaiCkiWZwOa4dsxGNB2VALCKOPOfk27B3gSk xMq7LPElYcQXPGw3OmT9fcGKYUBh1Oj9aKzck7gTMDsfXrTsNW6vUTAizeXs4v+sud1r t+UtepaqnAQb+TFDieh3v6WO2kjv+EV0hiq7wVPQLDEpIKpxzIyZT0IiP6ip9K1s0bbI J9B3jcryhcBHPV1NKkW3oHbPyAqS+BiayDap5beGM984GTWvjI87jn9+9FNw3Vb3Ry9U J2ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=xzELhgE3er5tMNQ9I7jJncHCuwtWilKXAa2ONw84yPk=; b=zEzBg93nwUgBJIOGLC9/W2+BN7bFT9sML9SKkk2CXMd0R4NBedV4DnErHXxJ+w622c EnwFlaQ9M/VwFZ654t8olpCISmBZL8dYURT01RyrZYxAZTVh8Yy9NzlJ9pxp1aAGHeGM Rqqs3fEXd/rSiaE+IrKAOa9odRn8J/1Plg2vfekOwL3tOCPJfXX4ozp+kxNTVl/OQfwj 4dAaLB+2qmfeO6Ejx7bPWySukLjhh1MICcDs94A7+9brAZqd92AICFKxy6uAPl9WzMsp M3amgqI1VBCrMl5KbGekFxfBnVcnwZxU8hux6MZWUhCjzlWwrbrX0PfVcGUQT01fBgKv F3Uw== X-Gm-Message-State: AO0yUKUM43684r7VGgMe1laKHdUdSqRNRfhtHfpGT0ouqZVQNdml3Bvf Wz8d2UQipShiwQtdcJSX4T8EO2kOgODMolil X-Received: by 2002:a05:600c:4d0a:b0:3dc:50c1:5fd4 with SMTP id u10-20020a05600c4d0a00b003dc50c15fd4mr24174441wmp.15.1676313836939; Mon, 13 Feb 2023 10:43:56 -0800 (PST) Received: from localhost.localdomain ([185.126.107.38]) by smtp.gmail.com with ESMTPSA id j37-20020a05600c1c2500b003daf6e3bc2fsm25423793wms.1.2023.02.13.10.43.55 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 13 Feb 2023 10:43:56 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org, Eduardo Habkost Cc: qemu-block@nongnu.org, Hu Tao , Gonglei Arei , Richard Henderson , Li Qiang , Thomas Huth , Cao jin , xiaoqiang zhao , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , "Michael S. Tsirkin" , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH v3 03/14] hw/char/serial-pci-multi: Introduce PCI_MULTISERIAL QOM abstract parent Date: Mon, 13 Feb 2023 19:43:27 +0100 Message-Id: <20230213184338.46712-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230213184338.46712-1-philmd@linaro.org> References: <20230213184338.46712-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.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=unavailable 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-bounces+patch=linaro.org@nongnu.org Introduce PCI_MULTISERIAL ("pci-serial"), QOM abstract parent of "pci-serial-2x" and "pci-serial-4x". Signed-off-by: Philippe Mathieu-Daudé --- hw/char/serial-pci-multi.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index 54768d3d53..e56c0bc841 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -38,8 +38,15 @@ #define PCI_SERIAL_MAX_PORTS 4 -typedef struct PCIMultiSerialState { +#define TYPE_PCI_MULTISERIAL "pci-serial-multi" + +OBJECT_DECLARE_SIMPLE_TYPE(PCIMultiSerialState, PCI_MULTISERIAL) + +struct PCIMultiSerialState { + /*< private >*/ PCIDevice dev; + /*< public >*/ + MemoryRegion iobar; uint32_t ports; char *name[PCI_SERIAL_MAX_PORTS]; @@ -47,7 +54,7 @@ typedef struct PCIMultiSerialState { uint32_t level[PCI_SERIAL_MAX_PORTS]; qemu_irq *irqs; uint8_t prog_if; -} PCIMultiSerialState; +}; static void multi_serial_pci_exit(PCIDevice *dev) { @@ -191,25 +198,23 @@ static void multi_serial_init(Object *o) static const TypeInfo multi_serial_pci_types[] = { { - .name = "pci-serial-2x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, - .class_init = multi_2x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { + .name = TYPE_PCI_MULTISERIAL, + .parent = TYPE_PCI_DEVICE, + .instance_size = sizeof(PCIMultiSerialState), + .instance_init = multi_serial_init, + .abstract = true, + .interfaces = (InterfaceInfo[]) { { INTERFACE_CONVENTIONAL_PCI_DEVICE }, { }, }, + }, { + .name = "pci-serial-2x", + .parent = TYPE_PCI_MULTISERIAL, + .class_init = multi_2x_serial_pci_class_initfn, }, { .name = "pci-serial-4x", - .parent = TYPE_PCI_DEVICE, - .instance_size = sizeof(PCIMultiSerialState), - .instance_init = multi_serial_init, + .parent = TYPE_PCI_MULTISERIAL, .class_init = multi_4x_serial_pci_class_initfn, - .interfaces = (InterfaceInfo[]) { - { INTERFACE_CONVENTIONAL_PCI_DEVICE }, - { }, - }, } };