From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:ac2:5544:0:0:0:0:0 with SMTP id l4csp197150lfk; Wed, 17 Nov 2021 22:57:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJzt29jMT18xlGu7/tAqGvlJCHZOHNHMBVeWZ+f9/zBeouzqK/VHp1KqMX372K884Z/JalX9 X-Received: by 2002:a05:6214:334:: with SMTP id j20mr62350741qvu.15.1637218641546; Wed, 17 Nov 2021 22:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637218641; cv=none; d=google.com; s=arc-20160816; b=FS0brDeKDcCPs0huKRY7qvYS79y32Hh+TYDurWzQGer3PDp0Tsx+WrXfwUHCoWu5/R iif5NnOBudwd9x64okKOwDdYF8PwDhoYGjtP0lX3c6Ol1BsWg6HnWpcVeLpfaS9fOroh dVSij4kFIR4DVTYsk0LY9rzgQElfWd4OHw6sRuoFsSoCM05j+p6+7/LdOm1KfQt10AVn pvWzkPMdFDLyyy3aQvKFBTMqkjXa/EgCAPD+avu2vY4gEu+givtlRd8f5ALdymNnYrtD UoHJDZKyeam5Pey9DroaGacBHqmdPUiLVGhfQPlrakd/C5IW19HLu4htHkoO6pVgfS02 ZaRA== 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:mime-version:user-agent :message-id:in-reply-to:date:references:subject:to:from :dkim-signature; bh=RQh2nPzLZ0bpcJKCbWKLD+G2mdW+RE9UfMD39mUoAj0=; b=xrpp22zSJdk6P+uI6uPs9JQ+kFHBpIZ1F0XVhB3qbdk9MsJncCgB3wn77edG9BT1Ys MYysIFxC02st9zsWYC8/RwgwXQ42xzPlTAeeKFaVBRS8QcmpXgTHbc7qm3MpwtIVqRZe 0yBkneXa5ubY3bL+OGGJbBaBWLc/ezhnWRHQS00Fdd7N0qRMfKjlQ76lApvYSehNSBh4 VIwHwzuHmyueVpBAkXKRDgi8ys9aZGdiP69G2lILaBCYGdlD6cAskLSRp/c1bHrRITZN FVtp+ezv74r2og4VQuXWbP2hEgQUTnaH3vDV0qKiZ6cGNgzdn42VJ3zNtOhlImR3wp7r 0G0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=GP5fK3bp; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x5si2874028qkd.152.2021.11.17.22.57.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 17 Nov 2021 22:57:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b=GP5fK3bp; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:59966 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mnbMG-0005cq-Td for alex.bennee@linaro.org; Thu, 18 Nov 2021 01:57:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnbLj-0005bi-3L for qemu-arm@nongnu.org; Thu, 18 Nov 2021 01:56:47 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26202) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mnbLg-0006ey-LJ for qemu-arm@nongnu.org; Thu, 18 Nov 2021 01:56:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637218600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RQh2nPzLZ0bpcJKCbWKLD+G2mdW+RE9UfMD39mUoAj0=; b=GP5fK3bpqJBEtKvM6A4XPEVTvAyEmFL/krnCdpeFFuIks5WiG26PqBR0DkIDeQQO919A1p Xwc5dwoZ92ix6OvdZ4pri+HeIn+5czk99lJSdcSlD9DS5WYFRoeC/hxCo2e3waK0COtWyo hMTp1lF3zc2c/mn+VRr6VaedpwE8Isg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-586-QP_jtTXnNsSW3ygJtVcDFg-1; Thu, 18 Nov 2021 01:56:36 -0500 X-MC-Unique: QP_jtTXnNsSW3ygJtVcDFg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F64687D541; Thu, 18 Nov 2021 06:56:35 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-112-7.ams2.redhat.com [10.36.112.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 81D0A604CC; Thu, 18 Nov 2021 06:56:34 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id DB13311380A7; Thu, 18 Nov 2021 07:56:32 +0100 (CET) From: Markus Armbruster To: Havard Skinnemoen Subject: Re: [PATCH v2 03/13] hw/arm/npcm7xx_boards: Replace drive_get_next() by drive_get() References: <20211117163409.3587705-1-armbru@redhat.com> <20211117163409.3587705-4-armbru@redhat.com> Date: Thu, 18 Nov 2021 07:56:32 +0100 In-Reply-To: (Havard Skinnemoen's message of "Wed, 17 Nov 2021 08:53:57 -0800") Message-ID: <874k8ax87z.fsf@dusky.pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=armbru@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Received-SPF: pass client-ip=170.10.133.124; envelope-from=armbru@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-block@nongnu.org, qemu-devel@nongnu.org, Hao Wu , Tyrone Ting , qemu-arm@nongnu.org Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: Tcnm1Yfndx3W Havard Skinnemoen writes: > On Wed, Nov 17, 2021 at 8:34 AM Markus Armbruster wrote: >> >> drive_get_next() is basically a bad idea. It returns the "next" block >> backend of a certain interface type. "Next" means bus=0,unit=N, where >> subsequent calls count N up from zero, per interface type. >> >> This lets you define unit numbers implicitly by execution order. If the >> order changes, or new calls appear "in the middle", unit numbers change. >> ABI break. Hard to spot in review. >> >> Machine "quanta-gbs-bmc" connects just one backend with >> drive_get_next(), but with a helper function. Change it to use >> drive_get() directly. This makes the unit numbers explicit in the >> code. >> >> Cc: Havard Skinnemoen >> Cc: Tyrone Ting >> Cc: Peter Maydell >> Cc: qemu-arm@nongnu.org >> Signed-off-by: Markus Armbruster >> --- >> hw/arm/npcm7xx_boards.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c >> index dec7d16ae5..d8a49e4e85 100644 >> --- a/hw/arm/npcm7xx_boards.c >> +++ b/hw/arm/npcm7xx_boards.c >> @@ -84,9 +84,9 @@ static void npcm7xx_connect_dram(NPCM7xxState *soc, MemoryRegion *dram) >> &error_abort); >> } >> >> -static void sdhci_attach_drive(SDHCIState *sdhci) >> +static void sdhci_attach_drive(SDHCIState *sdhci, int unit) >> { >> - DriveInfo *di = drive_get_next(IF_SD); >> + DriveInfo *di = drive_get(IF_SD, 0, unit); > > +Hao Wu IIRC the chip has separate SD and eMMC buses. Would it make > sense to take the bus number as a parameter as well? Is bus 0 the > right one to use in this case? > > The existing code always uses bus 0, so this is an improvement either way. Using separate buses for different kinds of devices would be neater, but it also would be an incompatible change. I can't judge whether incompatible change is okay here. This patch is just refactoring code. An interface change, if desired, should be a separate patch. > Reviewed-by: Havard Skinnemoen Thanks! > >> BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL; >> >> BusState *bus = qdev_get_child_bus(DEVICE(sdhci), "sd-bus"); >> @@ -374,7 +374,7 @@ static void quanta_gbs_init(MachineState *machine) >> drive_get(IF_MTD, 0, 0)); >> >> quanta_gbs_i2c_init(soc); >> - sdhci_attach_drive(&soc->mmc.sdhci); >> + sdhci_attach_drive(&soc->mmc.sdhci, 0); >> npcm7xx_load_kernel(machine, soc); >> } >> >> -- >> 2.31.1 >>