Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp450995ima; Wed, 6 Feb 2019 02:55:29 -0800 (PST) X-Google-Smtp-Source: AHgI3Ib7+hAxVdYlR0tCn2ChdtC48ELnhGt8QdziUu+QzCuhIkhBLi/EXb/5eicjwLBtB1ld7+c/ X-Received: by 2002:a63:334a:: with SMTP id z71mr9116278pgz.400.1549450529840; Wed, 06 Feb 2019 02:55:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549450529; cv=none; d=google.com; s=arc-20160816; b=ZMjkFsba/LLKo8lXiQpownsyyd9C6+fMpRTHChmmBnN1xtjBQ/lTJypxI5Ji1gUToB izaQGvxssYtX4CrF7AJbW8jBo8fy4p/dcdNCUrtjWDaeSZjI1S/Qw/mb9mGmvTdp38kN V7ks/hMZZncSf3tZZ0I/PDqiyzlqFLurhYv5fGjbOofjhNCjSV+Px67JFehH/NC4vvaT IVfzHM2LcD2JFpLG1fthdI3eFDRl8BUYnZUC72uzXRYGZUY7xTTM5CdUmdgsTWkfqfuE Z1IJYbmnTOhIDvSLTdRJSGnntQUfD+5EzskMSFjx0wW/F0I3pFiJgbQArjxA+wWnvAhg SE4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=VOFxxnAxh/irxLZTKoz4+dgfBr6MLQ9qGG9OEOtMGyU=; b=tu7oG1mkz53ljtZenWkakCS3si9myPyHYFzd5tETf3ca+F+Ey5btvX8cTcw2k6PFUJ tF8xfrHIjookpqSQdt7vEkBm0iNGPZOTgSjg6jizvsexAkRPMq+QgDyEQGJdYRWVtcA7 rH7wrM+kuan3aKvyxiuzvKuaUkHy5tw+w6XfPCXZyOv6jsW68f/Lm/Z2RJZaeztzpJuK 2AD9tDr9s0mCcKXK7gBCK9/GOJk3bkH4G0NWqxNIgx16UMmfCTsXnLt/4VL5JUhRT40D DX854iDs5cqy3G1cqajC0BSwmAShFccq7Aj7HgnpacjwAzRaDzy57XnTZq5Y87SZCWn8 NUTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4si5547089pfi.110.2019.02.06.02.55.14; Wed, 06 Feb 2019 02:55:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727628AbfBFKy5 (ORCPT + 99 others); Wed, 6 Feb 2019 05:54:57 -0500 Received: from mga01.intel.com ([192.55.52.88]:16674 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726914AbfBFKy5 (ORCPT ); Wed, 6 Feb 2019 05:54:57 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Feb 2019 02:54:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,339,1544515200"; d="asc'?scan'208";a="114104207" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.72.175]) by orsmga006.jf.intel.com with ESMTP; 06 Feb 2019 02:54:54 -0800 From: Felipe Balbi To: Nicolas Saenz Julienne , oneukum@suse.com, Mathias Nyman Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC v2] usb: xhci: add Immediate Data Transfer support In-Reply-To: <294f2492f8d3b7022bf659dcb473c45a34e85db8.camel@suse.de> References: <20190205195647.29258-1-nsaenzjulienne@suse.de> <87lg2tmnk3.fsf@linux.intel.com> <294f2492f8d3b7022bf659dcb473c45a34e85db8.camel@suse.de> Date: Wed, 06 Feb 2019 12:54:50 +0200 Message-ID: <871s4lmbk5.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, Nicolas Saenz Julienne writes: >> > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c >> > index 005e65922608..dec62f7f5dc8 100644 >> > --- a/drivers/usb/host/xhci.c >> > +++ b/drivers/usb/host/xhci.c >> > @@ -1238,6 +1238,21 @@ EXPORT_SYMBOL_GPL(xhci_resume); >> >=20=20 >> > /*-------------------------------------------------------------------= ------ >> > */ >> >=20=20 >> > +/* >> > + * Bypass the DMA mapping if URB is suitable for Immediate Transfer (= IDT), >> > + * we'll copy the actual data into the TRB address register. This is >> > limited to >> > + * transfers up to 8 bytes on output endpoints of any kind with >> > wMaxPacketSize >> > + * >=3D 8 bytes. >> > + */ >> > +static int xhci_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, >> > + gfp_t mem_flags) >> > +{ >> > + if (xhci_urb_suitable_for_idt(urb)) >> > + return 0; >> > + >> > + return usb_hcd_map_urb_for_dma(hcd, urb, mem_flags); >> > +} >>=20 >> don't you need a matching unmap_urb_for_dma()?? > > Not really as every DMA mapping sets a matching URB flag to track it. For > example when usb_hcd_map_urb_for_dma() uses dma_map_single() it will set > URB_DMA_MAP_SINGLE in urb->transfer_flags, later on unmap_urb_for_dma() w= ill > catch it and unmap it. As I bypass the mapping altogether there are no > flags set, so unmap_urb_for_dma() won't have any effect. > > I could still add it for clarity, and well, I guess it'll save some > instructions on the IDT suitable side. thanks for the clarification. >> > diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h >> > index 652dc36e3012..9d77b0901ab7 100644 >> > --- a/drivers/usb/host/xhci.h >> > +++ b/drivers/usb/host/xhci.h >> > @@ -1295,6 +1295,8 @@ enum xhci_setup_dev { >> > #define TRB_IOC (1<<5) >> > /* The buffer pointer contains immediate data */ >> > #define TRB_IDT (1<<6) >> > +/* TDs smaller than this might use IDT */ >>=20 >> Technically, "TDs at most this" since you're 8 itself is an allowed heh, I made a mess on this sentence, but I guess you got the gist of it. cheers =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlxavPoACgkQzL64meEa mQbEphAAx7v6Cfg8lcpqDO9sG4SdQ2xwsEQZVh7tGXIxH5g4P+4JeZonjmWSbpO+ jg+l7VXtMCBA03vkOSBEkhEePbdz5V9ew6CzPRVvcoqKubzBR2LaYXiCqolf7yol eLbNHDClKF5XGDnElQoMCYQqdP1A9tkeTxf1PRGQtIVvPP6hE9uqwe1upeyksihv v2R/wO5Ikj1FONhPhGptdp/Y6TpB6W3huks9xMHfdoGpybw27H6+C0hvWhn4C+1+ rzsWKYCGSNVWrumsp4Yvhi/fXhVp8KGtNLz0zqtPqm1vvOldpsOVCBHGJTcC7zXN BP/4k1PFj0DlkbUVQnXunzNTUeeZCRNfckyqjs+ikh7+DylAleZXXUZGLifsXk5f RI0vJ6EPDRv90F5arIy9n2bsM7U4uo9FPHXpc4F9lJD4Ccg3QUfCfv4PfiH/Ky5n ph1GgCu/cdNeuSc3h6o4kvyigoD2fXHPaG8GeY3F6eh0nEMcJJ4S5ZXsDwGOpDAN YNtw7d/+xVwnOle4VUi+aRQQ2KU45iSzNTDJDOvPqSYYjdbO/cOKjnopftsoaeMV fKByimVFXgu5ehVOL1pREyiQUpUjC+oUoUhQ4z5vLskL7DxIhComD+NDZPTteBvi 8xIjUDZvwA4x9UIgyQcFdaOoC7sXiMUZ4BLEWRI2uZzazgXnlLk= =YNGD -----END PGP SIGNATURE----- --=-=-=--