From owner-dev-commits-src-all@freebsd.org Fri Jan 8 19:13:35 2021 Return-Path: Delivered-To: dev-commits-src-all@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 C23F74D367B for ; Fri, 8 Jan 2021 19:13:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DCCSH4qrdz4rMR for ; Fri, 8 Jan 2021 19:13:35 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f50.google.com with SMTP id c5so9998783wrp.6 for ; Fri, 08 Jan 2021 11:13:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ao7yUu6uUSCQfFpwdrgetMQ/2BdodVz0kiNZGM8tsPo=; b=mHmjPT4arc05vJljJim5KX2Hh2hY4lL9rSLzYGg9jTQ32b887lUNJRJ7W3Q1rHMvN7 QFdOEDPYyj0a8bY9iAAyrJCswoPq/5Mu1RZpI+aArtCNWCEfB2ttLNyy4YjtQvOteZjy cwcyFc+iEvpzzoFoHGkSVkOFIXmh9HZhCsnqAa0JD7KKRQB+V3T3/IHohsGIwjwP0Znp ONV4kVVKgQAnHsSXpaGSSpb/T2/0iU7jVw0/jGOgoGS+ky9+Ul4MsYJK56fbKKhMT8oA /NeX6RRJ2kh4sz2FtmFbOans+uStuO9M9eJ/Bg7KXUB3hsxXCq+T4qq7FYf5cW5z8hoi njUw== X-Gm-Message-State: AOAM532uXY741nHwaxYG7mMTYm3HyhrovWg4yQRXBItsLW47zBGVoSoB G99//iL/XEbZGYo7f7MrYmGKMg== X-Google-Smtp-Source: ABdhPJzT92NykaaEAJGqA7nO77LQ16J/ZHar76bQ4dcu4+Cz/iNb10Gpo/JsNZ/SdiDxNRz8HyfLnQ== X-Received: by 2002:adf:e541:: with SMTP id z1mr5077312wrm.143.1610133213544; Fri, 08 Jan 2021 11:13:33 -0800 (PST) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id h29sm14680836wrc.68.2021.01.08.11.13.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jan 2021 11:13:32 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page From: Jessica Clarke In-Reply-To: <202101081729.108HTG7j066884@gitrepo.freebsd.org> Date: Fri, 8 Jan 2021 19:13:31 +0000 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> To: Chuck Tuffli X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4DCCSH4qrdz4rMR 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:13:35 -0000 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) =3D=3D 4096, > "bad size for nvme_command_effects_page"); >=20 > +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) =3D=3D 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 > } >=20 > +static inline void > +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s = __unused) > +{ > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > + uint64_t failing_lba; > + uint32_t r; > + > + for (r =3D 0; r < 20; r++) { > + s->result[r].poh =3D le64toh(s->result[r].poh); > + s->result[r].nsid =3D le32toh(s->result[r].nsid); > + /* Unaligned 64-bit loads fail on some architectures */ > + memcpy(&failing_lba, s->result[r].failing_lba, = sizeof(failing_lba)); > + failing_lba =3D le64toh(failing_lba); > + memcpy(s->result[r].failing_lba, &failing_lba, = sizeof(failing_lba)); > + } > +#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 = library 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 = 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