From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A379FC433E0 for ; Mon, 28 Dec 2020 19:33:34 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 153C722B2A for ; Mon, 28 Dec 2020 19:33:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 153C722B2A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ilande.co.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52052 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ktyGq-0000Vi-Le for qemu-devel@archiver.kernel.org; Mon, 28 Dec 2020 14:33:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktyEW-0008O4-FW for qemu-devel@nongnu.org; Mon, 28 Dec 2020 14:31:10 -0500 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:49018 helo=mail.default.ilande.uk0.bigv.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ktyEU-0006VN-Kt for qemu-devel@nongnu.org; Mon, 28 Dec 2020 14:31:08 -0500 Received: from host86-148-34-1.range86-148.btcentralplus.com ([86.148.34.1] helo=[192.168.1.65]) by mail.default.ilande.uk0.bigv.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ktyEO-0001SN-CU; Mon, 28 Dec 2020 19:31:02 +0000 To: BALATON Zoltan , qemu-devel@nongnu.org References: <19d68b4da7fc8dbffe3308c661143584ac830f29.1609107222.git.balaton@eik.bme.hu> From: Mark Cave-Ayland Message-ID: <080a04e0-e162-e80a-db6a-53bf4b43c9cb@ilande.co.uk> Date: Mon, 28 Dec 2020 19:30:55 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <19d68b4da7fc8dbffe3308c661143584ac830f29.1609107222.git.balaton@eik.bme.hu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 86.148.34.1 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: Re: [PATCH v2 1/2] ide: Make room for flags in PCIIDEState and add one for legacy mode X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.uk0.bigv.io) Received-SPF: pass client-ip=2001:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.uk0.bigv.io X-Spam_score_int: -45 X-Spam_score: -4.6 X-Spam_bar: ---- X-Spam_report: (-4.6 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-2.698, 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: Huacai Chen , John Snow , Guenter Roeck , f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 27/12/2020 22:13, BALATON Zoltan wrote: > We'll need a flag for implementing some device specific behaviour in > via-ide but we already have a currently CMD646 specific field that can > be repurposed for this and leave room for further flags if needed in > the future. This patch changes the "secondary" field to "flags" and > change CMD646 and its users accordingly and define a new flag for > forcing legacy mode that will be used by via-ide for now. > > Signed-off-by: BALATON Zoltan > Reviewed-by: Philippe Mathieu-Daudé > Reviewed-by: Guenter Roeck > Tested-by: Guenter Roeck > --- > v2: Fixed typo in commit message > > hw/ide/cmd646.c | 4 ++-- > hw/sparc64/sun4u.c | 2 +- > include/hw/ide/pci.h | 7 ++++++- > 3 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c > index c254631485..7a96016116 100644 > --- a/hw/ide/cmd646.c > +++ b/hw/ide/cmd646.c > @@ -256,7 +256,7 @@ static void pci_cmd646_ide_realize(PCIDevice *dev, Error **errp) > pci_conf[PCI_CLASS_PROG] = 0x8f; > > pci_conf[CNTRL] = CNTRL_EN_CH0; // enable IDE0 Doesn't the existing comment above cause checkpatch to fail? > - if (d->secondary) { > + if (d->flags & BIT(PCI_IDE_SECONDARY)) { > /* XXX: if not enabled, really disable the seconday IDE controller */ > pci_conf[CNTRL] |= CNTRL_EN_CH1; /* enable IDE1 */ > } > @@ -314,7 +314,7 @@ static void pci_cmd646_ide_exitfn(PCIDevice *dev) > } > > static Property cmd646_ide_properties[] = { > - DEFINE_PROP_UINT32("secondary", PCIIDEState, secondary, 0), > + DEFINE_PROP_BIT("secondary", PCIIDEState, flags, PCI_IDE_SECONDARY, false), > DEFINE_PROP_END_OF_LIST(), > }; > > diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c > index 0fa13a7330..c46baa9f48 100644 > --- a/hw/sparc64/sun4u.c > +++ b/hw/sparc64/sun4u.c > @@ -674,7 +674,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem, > } > > pci_dev = pci_new(PCI_DEVFN(3, 0), "cmd646-ide"); > - qdev_prop_set_uint32(&pci_dev->qdev, "secondary", 1); > + qdev_prop_set_bit(&pci_dev->qdev, "secondary", true); > pci_realize_and_unref(pci_dev, pci_busA, &error_fatal); > pci_ide_create_devs(pci_dev); > > diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h > index d8384e1c42..75d1a32f6d 100644 > --- a/include/hw/ide/pci.h > +++ b/include/hw/ide/pci.h > @@ -42,6 +42,11 @@ typedef struct BMDMAState { > #define TYPE_PCI_IDE "pci-ide" > OBJECT_DECLARE_SIMPLE_TYPE(PCIIDEState, PCI_IDE) > > +enum { > + PCI_IDE_SECONDARY, /* used only for cmd646 */ > + PCI_IDE_LEGACY_MODE > +}; > + > struct PCIIDEState { > /*< private >*/ > PCIDevice parent_obj; > @@ -49,7 +54,7 @@ struct PCIIDEState { > > IDEBus bus[2]; > BMDMAState bmdma[2]; > - uint32_t secondary; /* used only for cmd646 */ > + uint32_t flags; > MemoryRegion bmdma_bar; > MemoryRegion cmd_bar[2]; > MemoryRegion data_bar[2]; Other than that I think this looks okay. ATB, Mark.