From nobody Thu Jan 23 02:42:07 2025 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YdlbL1HgXz5lTLt for ; Thu, 23 Jan 2025 02:42:22 +0000 (UTC) (envelope-from j_yoon.choi@samsung.com) Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mailout1.samsung.com", Issuer "DigiCert Global G2 TLS RSA SHA256 2020 CA1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YdlbJ2Bfvz43YW for ; Thu, 23 Jan 2025 02:42:19 +0000 (UTC) (envelope-from j_yoon.choi@samsung.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=AoUlMvLY; spf=pass (mx1.freebsd.org: domain of j_yoon.choi@samsung.com designates 203.254.224.24 as permitted sender) smtp.mailfrom=j_yoon.choi@samsung.com; dmarc=pass (policy=none) header.from=samsung.com Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20250123024215epoutp014ee96cfc0b74c7ae177081b62863c2c7~dMh3wITl10800308003epoutp01B for ; Thu, 23 Jan 2025 02:42:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20250123024215epoutp014ee96cfc0b74c7ae177081b62863c2c7~dMh3wITl10800308003epoutp01B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1737600135; bh=EsO4NWu/LYDHEfD7iGPKC08NU0Gy3MM6NQQ2ACXCTEY=; h=Subject:Reply-To:From:To:CC:In-Reply-To:Date:References:From; b=AoUlMvLYV7WuWdAc2gl9ukkd8QZ7XesmBvjX9L1p2bVwuIpruPsJSFzoR7Az044J9 Gc3bOk3JxW2GH08LBWsafsgc+fOWCHKtY1CVi8AUX1mktX54CrkXs0R6As+Y9oMlJE zOTceeF0MoNhjrC41/scNliwMe2Q91WjCAQrhclg= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20250123024215epcas2p39f59f7fc39ab1903d8d2f99a05243698~dMh3bNxoL2644526445epcas2p3a; Thu, 23 Jan 2025 02:42:15 +0000 (GMT) Received: from epsmges2p1.samsung.com (unknown [182.195.36.68]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4YdlbB2dsqz4x9Q9; Thu, 23 Jan 2025 02:42:14 +0000 (GMT) X-AuditID: b6c32a45-db1ed70000005b48-a0-6791ac7f5c5b Received: from epcas2p2.samsung.com ( [182.195.41.54]) by epsmges2p1.samsung.com (Symantec Messaging Gateway) with SMTP id C1.02.23368.F7CA1976; Thu, 23 Jan 2025 11:42:07 +0900 (KST) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org Mime-Version: 1.0 Subject: Re: Universal Flash Storage Driver Proposal Reply-To: j_yoon.choi@samsung.com From: Jaeyoon Choi To: Warner Losh CC: "freebsd-hackers@FreeBSD.org" X-Priority: 3 X-Content-Kind-Code: NORMAL In-Reply-To: X-CPGS-Detection: blocking_info_exchange X-Drm-Type: N,general X-Msg-Generator: Mail X-Msg-Type: PERSONAL X-Reply-Demand: N Message-ID: <20250123024207epcms2p1782d2ff74077c1f215fbdb0ae5f3aa09@epcms2p1> Date: Thu, 23 Jan 2025 11:42:07 +0900 X-CMS-MailID: 20250123024207epcms2p1782d2ff74077c1f215fbdb0ae5f3aa09 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: AUTO_CONFIDENTIAL CMS-TYPE: 102P X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrr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zGe wrhStELt+cHTyU0KR498/v4uvmhFZPS6prXP3t7LYqxSMvXYczNh1xvj88VFnT9C1Dd0tjFy N75/7Lcq9Zz0hKiFSizFGYmGWsxFxYkAF1fGcPADAAA= DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20250117045346epcms2p61099ea651d3ca3f00e3134dd00e6a9ac References: <20250117045346epcms2p61099ea651d3ca3f00e3134dd00e6a9ac@epcms2p6> <20250121002602epcms2p6067990e98b8143ff596d90af0ec54492@epcms2p6> X-Spamd-Result: default: False [-4.80 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DWL_DNSWL_LOW(-1.00)[samsung.com:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.997]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; DMARC_POLICY_ALLOW(-0.50)[samsung.com,none]; MV_CASE(0.50)[]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_IN_DNSWL_MED(-0.20)[203.254.224.24:from]; R_DKIM_ALLOW(-0.20)[samsung.com:s=mail20170921]; R_SPF_ALLOW(-0.20)[+ip4:203.254.224.0/24]; MIME_GOOD(-0.10)[text/plain]; RWL_MAILSPIKE_GOOD(-0.10)[203.254.224.24:from]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[samsung.com:+]; HAS_X_PRIO_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; REPLYTO_ADDR_EQ_FROM(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; ASN(0.00)[asn:6619, ipnet:203.254.224.0/24, country:KR]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; REPLYTO_DOM_NEQ_TO_DOM(0.00)[]; MISSING_XM_UA(0.00)[]; HAS_REPLYTO(0.00)[j_yoon.choi@samsung.com] X-Spamd-Bar: ---- X-Rspamd-Queue-Id: 4YdlbJ2Bfvz43YW =20 > Generally, yes. However, looking at umass, you'll see that different kind= s of USB > thumb drives have different subsets of SCSI that are supported. For examp= le, RBC > is a reduced subset of commands, and umass filters things so that we have= the right > length (only READ(10) and WRITE(10) are supported for RBC, for example). = I'd image > there'd be a similar list for UFS and you'd need to arrange for scsi_da t= o only generate > those. It looks like some kind of quirk info is going on to force this, b= ut I've not puzzled > through all the layers to find it. umass also does some minor CDB rewriti= ng for things > like ATAPI that are close. UFI also has a different subset that's support= ed. Thanks for letting me know, I will study the scsi_da code more. > Right now that's all handled by the SIM setting cpi.hba_misc =7C=3D PIM_N= O_6_BYTE for > the CAM_PATH_INQ xpt request. You may need to create a PIM_NO_10_BYTE if > only the 12 byte variants are supported, or find some other way to signal= to scsi_da that > it must choose a different way to generate commands (if say a single bit = isn't enough, > or it turns into too much of a specialty quirk flag) There are three restrictions that I found in UFS spec (MODE SENSE(6), READ(= 12) and WRITE(12)), I think adding the following two flags to cpi.hba_misc should be enough: - PIM_NO_12_BYTE - PIM_NO_6_BYTE_MODE_SENSE But I'll take a look at the UFS spec documentation to see if there are more restrictions needed. > Though having said that, I kinda think > we can retire all the 6-byte command support: we don't need it on anythin= g modern and > it really is there for the pre-scsi-1 SASI drives that we don't support= =5B*=5D. We may also want > to rework the number of special cases we have in scsi_da.c as well. There= 's a number > of quirks that either go away with no-6-byte commands, or that can be gue= ssed w/o a loud > message to the user (which is why we avoid sending them with the quirk, t= hough some > of that avoidance is because some early drives hung).=C2=A0=0D=0A=0D=0AI= =20don't=20know=20if=20this=20helps,=20but=20Fuchsia=20OS=20has=20decided= =20not=20to=20support=0D=0AREAD(6)/WRITE(6)=20commands.=0D=0A(Fuchsia's=20S= CSI=20layer=20is=20still=20in=20the=20early=20stages=20of=20development)=0D= =0A-=20https://fuchsia-review.googlesource.com/c/fuchsia/+/932832/comments/= 72826c28_c48b071d?tab=3Dcomments=0D=0A=0D=0A>=20So=20the=20SCSI=20protocol= =20likely=20can=20still=20be=20used,=20but=20some=20adjustments=20might=20b= e=20needed=0D=0A>=20to=20the=20SCSI=20transport=20(though=20the=20distincti= on=20between=20the=20two=20can=20get=20rather=20confused=20at=0D=0A>=20time= s).=20=20Eg,=20I=20think=20eventually=20you'll=20find=20you'll=20want=20a= =20XPORT_UFS=20to=20sit=20along=20side=0D=0A>=20XPORT_FC,=20XPORT_SPI,=20XP= ORT_SAS,=20etc.=20I=20think=20the=20protocol=20will=20be=20PROTO_SCSI=0D=0A= >=20for=20everything.=20Each=20of=20the=20transports=20can=20and=20do=20rep= ort=20slightly=20different=20things=20in=20handled=0D=0A>=20by=20XPT_GET_TR= AN_SETTINGS=20and=20XPT_SET_TRAN_SETTINGS=20messages.=0D=0A=0D=0AI=20was=20= confusing=20SCSI=20protocol=20and=20SCSI=20transport.=20Thanks=20for=20the= =20clarification.=0D=0AI=20agree=20with=20you=20that=20we=20should=20add=20= XPORT_UFS.=20I=20will=20study=20it=20more=20and=20share=0D=0Amy=20design.= =0D=0A=0D=0A>=20I=20hope=20my=20advice=20is=20useful.=20Also,=20although=20= I've=20given=20talks=20on=20this=20topic,=20you=20should=20double=0D=0A>=20= check=20anything=20I=20said=20in=20those=20talks=20or=20that=20I=20say=20he= re.=20(a)=20It=20will=20help=20you=20learn=20CAM=20better=0D=0A>=20and=20(b= )=20some=20of=20these=20details=20I=20only=20think=20I=20know=20and=20under= stand,=20but=20I'm=20missing=20something=0D=0A>=20subtle=20(if=20I=20knew= =20which=20points,=20I'd=20say=20:).=0D=0A>=20=0D=0A>=20Good=20luck=20with= =20everything,=20and=20don't=20hesitate=20to=20ask=20if=20you=20have=20ques= tions,=20want=20some=20early=0D=0A>=20code=20review,=20design=20advice,=20e= tc.=0D=0A=0D=0AI=20was=20confused=20and=20your=20advice=20cleared=20up=20a= =20lot=20of=20my=20questions.=0D=0AI=20will=20definitely=20check=20out=20yo= ur=20talks=20again.=0D=0A=0D=0AHere=20are=20a=20few=20questions=20that=20co= me=20to=20mind:=0D=0A1.=20i'm=20trying=20to=20take=20the=20overall=20struct= ure=20similar=20to=20NVMe,=20is=20that=20okay?=0D=0A=20=20=20(nvme_controll= er,=20nvme_namespace,=20nvme_qpair,=20nvme_request,=20nvme_tracker,=0D=0A= =20=20=20etc.)=0D=0A2.=20is=20there=20any=20tool=20or=20test=20I=20can=20tr= y=20to=20test=20the=20block=20device=20while=20I'm=0D=0A=20=20=20developing= ,=20I'm=20curious=20to=20know=20how=20you=20are=20testing=20it.=0D=0A=0D=0A= FYI,=20I'll=20be=20out=20of=20the=20office=20for=205=20weeks=20starting=20i= n=20February,=20so=20I'll=0D=0Aprobably=20start=20development=20in=20mid-Ma= rch.=0D=0APerhaps=20I=20can=20ask=20more=20detailed=20questions=20at=20that= =20time.=0D=0A=0D=0AThank=20you,=0D=0AJaeyoon=20