From owner-dev-commits-src-main@freebsd.org Fri Jan 8 19:20:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BBDF4D3C1D; Fri, 8 Jan 2021 19:20:36 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DCCcN0fk5z4rvB; Fri, 8 Jan 2021 19:20:35 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xxJHkls3334axxxJIkfvuw; Fri, 08 Jan 2021 12:20:33 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff8b081 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=q70-2Ng7odlXIZddMxEA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 30E0E1EA; Fri, 8 Jan 2021 11:20:30 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 108JKUd2003299; Fri, 8 Jan 2021 11:20:30 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101081920.108JKUd2003299@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jessica Clarke cc: Chuck Tuffli , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page In-reply-to: <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> Comments: In-reply-to Jessica Clarke message dated "Fri, 08 Jan 2021 19:13:31 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 08 Jan 2021 11:20:30 -0800 X-CMAE-Envelope: MS4xfMHHSzvR8srN4yzs6ExQ+4xSAL4jsSEioRuEH5dos1dpXrAqaF/UTOVkHdAsAUGdT53wsSyIqNuHr/ygeWEB+cqtb9xQ30WGZW1QSNGGtlxT+GxeWYl+ FR6EaNp3p9JCOfKyQtOswwEKPNJZYphOP8TUb7vB7B9wWP+GIjDeOe5bsSYNN3l5E+zdvGbViJT6zpFWN0mu68yRS0LdmJJGKyfi1I/X6vVEaTNxUsoXBnOV PDNH0fnCKlpcFgX1Vln9dRv2pdZbfrp3z31Eugc8NK19I9a3i+XA2MlWMvNHlrC9tNnScOOBw1qQGO3HxmlfAdC5M3s1Lkf8j3c5LHhRKuIYk7XXuW2GKqKJ Tw4XsbeE X-Rspamd-Queue-Id: 4DCCcN0fk5z4rvB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:20:36 -0000 In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, Jessica Clarke w rites: > On 8 Jan 2021, at 17:29, Chuck Tuffli wrote: > > diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h > > index 3c159b1fd0fc..67d02ba73fd8 100644 > > --- a/sys/dev/nvme/nvme.h > > +++ b/sys/dev/nvme/nvme.h > > @@ -1396,6 +1396,28 @@ struct nvme_command_effects_page { > > _Static_assert(sizeof(struct nvme_command_effects_page) == 4096, > > "bad size for nvme_command_effects_page"); > > > > +struct nvme_device_self_test_page { > > + uint8_t curr_operation; > > + uint8_t curr_compl; > > + uint8_t rsvd2[2]; > > + struct { > > + uint8_t status; > > + uint8_t segment_num; > > + uint8_t valid_diag_info; > > + uint8_t rsvd3; > > + uint64_t poh; > > + uint32_t nsid; > > + /* Define as an array to simplify alignment issues */ > > + uint8_t failing_lba[8]; > > + uint8_t status_code_type; > > + uint8_t status_code; > > + uint8_t vendor_specific[2]; > > + } __packed result[20]; > > +} __packed __aligned(4); > > + > > +_Static_assert(sizeof(struct nvme_device_self_test_page) == 564, > > + "bad size for nvme_device_self_test_page"); > > + > > struct nvme_res_notification_page { > > uint64_t log_page_count; > > uint8_t log_page_type; > > @@ -2016,4 +2038,21 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv > _status_ext *s __unused, > > #endif > > } > > > > +static inline void > > +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __unu > sed) > > +{ > > +#if _BYTE_ORDER != _LITTLE_ENDIAN > > + uint64_t failing_lba; > > + uint32_t r; > > + > > + for (r = 0; r < 20; r++) { > > + s->result[r].poh = le64toh(s->result[r].poh); > > + s->result[r].nsid = le32toh(s->result[r].nsid); > > + /* Unaligned 64-bit loads fail on some architectures */ > > + memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_l > ba)); > > + failing_lba = le64toh(failing_lba); > > + memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_l > ba)); > > + } > > +#endif > > +} > > #endif /* __NVME_H__ */ > > Hi, > This broke powerpc and powerpc64: > > In file included from ioctl.c:33: > In file included from /home/jrtc27/src/sys/./cam/scsi/scsi_pass.h:35: > In file included from /home/jrtc27/src/sys/cam/cam_ccb.h:46: > In file included from /home/jrtc27/src/sys/cam/nvme/nvme_all.h:33: > /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: error: implicitly declaring libr > ary function 'memcpy' with type 'void *(void *, const void *, unsigned long)' > [-Werror,-Wimplicit-function-declaration] > memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing > _lba)); > ^ > /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: note: include the header .h> or explicitly provide a declaration for 'memcpy' > 1 error generated. > --- ioctl.o --- > *** [ioctl.o] Error code 1 > > make[7]: stopped in /home/jrtc27/src/lib/libsysdecode > 1 error > > Jess > > It also broke i386 (not amd64), needing a %jd instead of %ld. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few.