Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3597111iog; Tue, 21 Jun 2022 01:56:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tfycM9I6Z77YFq/wnnHU9FZQg3Cb0jDRE5ppbNDcPBABKtDt2L/ijLZJYyLpvtk5Pw+0ui X-Received: by 2002:a17:906:a45a:b0:711:d546:478f with SMTP id cb26-20020a170906a45a00b00711d546478fmr23677034ejb.741.1655801802194; Tue, 21 Jun 2022 01:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655801802; cv=none; d=google.com; s=arc-20160816; b=qfLE6TIpqR//YECo7oh0795fccgxkeP9Eslu76VoGGkCRyNaKRdSk/urKOHFZ8Qcuq AHxNw+xpwF1vTkSHTFwJ0jQFf0Wfh4X1w1qROSig0tXy32LPt7uUGjmOZtQ8VKDiW6Cs px1nOQYjpc9/F6F9Ncxp4nQ1/uCN+y1nxt8SsITCS/qnIE2pQ28QIQglvvwzPBQNynOq crRhX3ayvRSFk96W5sRJ3A4njYvmvMkIq1fxskavYnJPr44dei7CirWB4RMAhCacJqZA pqueXyHgrtZ0NQFSTZ/++8O+l14vU7oeS41HUxttTnpaYP9lI4Wyu46wDPNKV9bAvu82 CvMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=7pouBC4i764FgZXOuJ6SFkbk2xa1PZt6dSFI3XEoLes=; b=riPsd4IQN4lyXKtyhLzpbEyGlF5pBt2G7LPAdivGgXoXRKQUcPwOmyYHOo84HudcFo 6xFuh2e+P0NCZTgOPvkQI0fdBpPgJzcR3ZWk+F0GZil4IUAJ9vbl7DNAp7WpFJZJ1B+s xKLBQ2Ne2wGvsg+/IqJkT9VAQfNPi/Zf23K4yNFDWF3DmYdxtYRP6H1CF5PLSCk4jzJe xEntGwSVIoBP6RY7aAW+O+QA2mEv13YvG4TsO+psG9mz1zR+/kcrC9pi1JM/NIYShrPF W+UbW8n5ey3PIPOUTN2EiKWRlrI1+axv8FZ3A8h6+mrqjFiGlK4GZEmoAGJTDM1wEMqv u0iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=BxLNshCD; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c25-20020a1709063f1900b00712163f78d0si15607468ejj.533.2022.06.21.01.56.15; Tue, 21 Jun 2022 01:56:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=BxLNshCD; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348368AbiFUIp5 (ORCPT + 99 others); Tue, 21 Jun 2022 04:45:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230456AbiFUIpz (ORCPT ); Tue, 21 Jun 2022 04:45:55 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AB9D26553; Tue, 21 Jun 2022 01:45:54 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0974F1F966; Tue, 21 Jun 2022 08:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1655801153; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7pouBC4i764FgZXOuJ6SFkbk2xa1PZt6dSFI3XEoLes=; b=BxLNshCDBQRc4XmBU9sLjI5ynrIOKZzeUOi0zGyby68AWR+NLDKh1gQWWSjQmyLNWRb+W0 dy0bLKDuzMCdi110ykiH+iFiyHYjXJJ9LzLM8QxvKgjLk/ggBpz5iUtfZUkwmUxpm4jxDI CIeoXXpEVaSAUBtAywORVhvrAqEkhoM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1655801153; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7pouBC4i764FgZXOuJ6SFkbk2xa1PZt6dSFI3XEoLes=; b=k6ybPuTnlEi+J6ckMb+UuqBX0ObNoZVxlTDbFsuZr7WGvkpdlP8i7LXSwEWQ9sn0i6kP5E tdUC8b/eV67CtfCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D3B6C13A88; Tue, 21 Jun 2022 08:45:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qHp9M0CFsWJvEAAAMHmgww (envelope-from ); Tue, 21 Jun 2022 08:45:52 +0000 Message-ID: Date: Tue, 21 Jun 2022 10:45:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v2 2/3] scsi: BusLogic remove bus_to_virt Content-Language: en-US To: Arnd Bergmann , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Jakub Kicinski , Christoph Hellwig , Marek Szyprowski , Robin Murphy , iommu@lists.linux-foundation.org, Khalid Aziz , "Maciej W . Rozycki" , Matt Wang , Miquel van Smoorenburg , Mark Salyzyn , linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, linux-alpha@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-parisc@vger.kernel.org, Denis Efremov References: <20220617125750.728590-1-arnd@kernel.org> <20220617125750.728590-3-arnd@kernel.org> From: Hannes Reinecke In-Reply-To: <20220617125750.728590-3-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/17/22 14:57, Arnd Bergmann wrote: > From: Arnd Bergmann > > The BusLogic driver is the last remaining driver that relies on the > deprecated bus_to_virt() function, which in turn only works on a few > architectures, and is incompatible with both swiotlb and iommu support. > > Before commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit."), > the driver had a dependency on x86-32, presumably because of this > problem. However, the change introduced another bug that made it still > impossible to use the driver on any 64-bit machine. > > This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix > 64-bit system enumeration error for Buslogic"), 8 years later, which > shows that there are not a lot of users. > > Maciej is still using the driver on 32-bit hardware, and Khalid mentioned > that the driver works with the device emulation used in VirtualBox > and VMware. Both of those only emulate it for Windows 2000 and older > operating systems that did not ship with the better LSI logic driver. > > Do a minimum fix that searches through the list of descriptors to find > one that matches the bus address. This is clearly as inefficient as > was indicated in the code comment about the lack of a bus_to_virt() > replacement. A better fix would likely involve changing out the entire > descriptor allocation for a simpler one, but that would be much > more invasive. > > Cc: Maciej W. Rozycki > Cc: Matt Wang > Cc: Khalid Aziz > Signed-off-by: Arnd Bergmann > --- > drivers/scsi/BusLogic.c | 27 ++++++++++++++++----------- > drivers/scsi/Kconfig | 2 +- > 2 files changed, 17 insertions(+), 12 deletions(-) > > diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c > index a897c8f914cf..d057abfcdd5c 100644 > --- a/drivers/scsi/BusLogic.c > +++ b/drivers/scsi/BusLogic.c > @@ -2515,12 +2515,26 @@ static int blogic_resultcode(struct blogic_adapter *adapter, > return (hoststatus << 16) | tgt_status; > } > > +/* > + * turn the dma address from an inbox into a ccb pointer > + * This is rather inefficient. > + */ > +static struct blogic_ccb * > +blogic_inbox_to_ccb(struct blogic_adapter *adapter, struct blogic_inbox *inbox) > +{ > + struct blogic_ccb *ccb; > + > + for (ccb = adapter->all_ccbs; ccb; ccb = ccb->next_all) > + if (inbox->ccb == ccb->dma_handle) > + break; > + > + return ccb; > +} > > /* > blogic_scan_inbox scans the Incoming Mailboxes saving any > Incoming Mailbox entries for completion processing. > */ > - > static void blogic_scan_inbox(struct blogic_adapter *adapter) > { > /* > @@ -2540,16 +2554,7 @@ static void blogic_scan_inbox(struct blogic_adapter *adapter) > enum blogic_cmplt_code comp_code; > > while ((comp_code = next_inbox->comp_code) != BLOGIC_INBOX_FREE) { > - /* > - We are only allowed to do this because we limit our > - architectures we run on to machines where bus_to_virt( > - actually works. There *needs* to be a dma_addr_to_virt() > - in the new PCI DMA mapping interface to replace > - bus_to_virt() or else this code is going to become very > - innefficient. > - */ > - struct blogic_ccb *ccb = > - (struct blogic_ccb *) bus_to_virt(next_inbox->ccb); > + struct blogic_ccb *ccb = blogic_inbox_to_ccb(adapter, adapter->next_inbox); > if (comp_code != BLOGIC_CMD_NOTFOUND) { > if (ccb->status == BLOGIC_CCB_ACTIVE || > ccb->status == BLOGIC_CCB_RESET) { > diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig > index cf75588a2587..56bdc08d0b77 100644 > --- a/drivers/scsi/Kconfig > +++ b/drivers/scsi/Kconfig > @@ -513,7 +513,7 @@ config SCSI_HPTIOP > > config SCSI_BUSLOGIC > tristate "BusLogic SCSI support" > - depends on PCI && SCSI && VIRT_TO_BUS > + depends on PCI && SCSI > help > This is support for BusLogic MultiMaster and FlashPoint SCSI Host > Adapters. Consult the SCSI-HOWTO, available from CCB handling in the driver is ugly anyway, so that'll be good enough. Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer