diff mbox series

[v3,1/1] virtio_bt: Fix alignment in configuration struct

Message ID 20221018191911.589564-2-Igor.Skalkin@opensynergy.com (mailing list archive)
State Superseded
Headers show
Series virtio_bt: Fix alignment in configuration struct | expand

Checks

Context Check Description
tedd_an/pre-ci_am fail error: patch failed: drivers/bluetooth/virtio_bt.c:306 error: drivers/bluetooth/virtio_bt.c: patch does not apply error: patch failed: include/uapi/linux/virtio_bt.h:9 error: include/uapi/linux/virtio_bt.h: patch does not apply hint: Use 'git am --show-current-patch' to see the failed patch

Commit Message

Igor Skalkin Oct. 18, 2022, 7:19 p.m. UTC
The current version of the configuration structure has unaligned
16-bit fields, but according to the specification [1], access to
the configuration space must be aligned.

Add a second, aligned  version of the configuration structure
and a new feature bit indicating that this version is being used.

[1] https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.pdf

Signed-off-by: Igor Skalkin <Igor.Skalkin@opensynergy.com>
---
 drivers/bluetooth/virtio_bt.c  | 16 +++++++++++++---
 include/uapi/linux/virtio_bt.h |  8 ++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)

--
2.37.2


Please mind our privacy notice<https://www.opensynergy.com/datenschutzerklaerung/privacy-notice-for-business-partners-pursuant-to-article-13-of-the-general-data-protection-regulation-gdpr/> pursuant to Art. 13 GDPR. // Unsere Hinweise zum Datenschutz gem. Art. 13 DSGVO finden Sie hier.<https://www.opensynergy.com/de/datenschutzerklaerung/datenschutzhinweise-fuer-geschaeftspartner-gem-art-13-dsgvo/>

Comments

bluez.test.bot@gmail.com Oct. 18, 2022, 7:54 p.m. UTC | #1
This is an automated email and please do not reply to this email.

Dear Submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.

----- Output -----
error: patch failed: drivers/bluetooth/virtio_bt.c:306
error: drivers/bluetooth/virtio_bt.c: patch does not apply
error: patch failed: include/uapi/linux/virtio_bt.h:9
error: include/uapi/linux/virtio_bt.h: patch does not apply
hint: Use 'git am --show-current-patch' to see the failed patch


Please resolve the issue and submit the patches again.


---
Regards,
Linux Bluetooth
Luiz Augusto von Dentz Oct. 18, 2022, 8:31 p.m. UTC | #2
Hi Igor,

On Tue, Oct 18, 2022 at 12:58 PM <bluez.test.bot@gmail.com> wrote:
>
> This is an automated email and please do not reply to this email.
>
> Dear Submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> While preparing the CI tests, the patches you submitted couldn't be applied to the current HEAD of the repository.
>
> ----- Output -----
> error: patch failed: drivers/bluetooth/virtio_bt.c:306
> error: drivers/bluetooth/virtio_bt.c: patch does not apply
> error: patch failed: include/uapi/linux/virtio_bt.h:9
> error: include/uapi/linux/virtio_bt.h: patch does not apply
> hint: Use 'git am --show-current-patch' to see the failed patch
>
>
> Please resolve the issue and submit the patches again.

This is very likely due to your mail server changing the format of the
patch, you can use gmail to send the email like you did previously,
that doesn't affect the commit author which is what needs to match the
Signed-off-by.

>
> ---
> Regards,
> Linux Bluetooth
>
diff mbox series

Patch

diff --git a/drivers/bluetooth/virtio_bt.c b/drivers/bluetooth/virtio_bt.c
index 67c21263f9e0..35f8041722c8 100644
--- a/drivers/bluetooth/virtio_bt.c
+++ b/drivers/bluetooth/virtio_bt.c
@@ -306,7 +306,12 @@  static int virtbt_probe(struct virtio_device *vdev)
        if (virtio_has_feature(vdev, VIRTIO_BT_F_VND_HCI)) {
                __u16 vendor;

-               virtio_cread(vdev, struct virtio_bt_config, vendor, &vendor);
+               if (virtio_has_feature(vdev, VIRTIO_BT_F_CONFIG_V2))
+                       virtio_cread(vdev, struct virtio_bt_config_v2,
+                                    vendor, &vendor);
+               else
+                       virtio_cread(vdev, struct virtio_bt_config,
+                                    vendor, &vendor);

                switch (vendor) {
                case VIRTIO_BT_CONFIG_VENDOR_ZEPHYR:
@@ -339,8 +344,12 @@  static int virtbt_probe(struct virtio_device *vdev)
        if (virtio_has_feature(vdev, VIRTIO_BT_F_MSFT_EXT)) {
                __u16 msft_opcode;

-               virtio_cread(vdev, struct virtio_bt_config,
-                            msft_opcode, &msft_opcode);
+               if (virtio_has_feature(vdev, VIRTIO_BT_F_CONFIG_V2))
+                       virtio_cread(vdev, struct virtio_bt_config_v2,
+                                    msft_opcode, &msft_opcode);
+               else
+                       virtio_cread(vdev, struct virtio_bt_config,
+                                    msft_opcode, &msft_opcode);

                hci_set_msft_opcode(hdev, msft_opcode);
        }
@@ -387,6 +396,7 @@  static const unsigned int virtbt_features[] = {
        VIRTIO_BT_F_VND_HCI,
        VIRTIO_BT_F_MSFT_EXT,
        VIRTIO_BT_F_AOSP_EXT,
+       VIRTIO_BT_F_CONFIG_V2,
 };

 static struct virtio_driver virtbt_driver = {
diff --git a/include/uapi/linux/virtio_bt.h b/include/uapi/linux/virtio_bt.h
index a7bd48daa9a9..af798f4c9680 100644
--- a/include/uapi/linux/virtio_bt.h
+++ b/include/uapi/linux/virtio_bt.h
@@ -9,6 +9,7 @@ 
 #define VIRTIO_BT_F_VND_HCI    0       /* Indicates vendor command support */
 #define VIRTIO_BT_F_MSFT_EXT   1       /* Indicates MSFT vendor support */
 #define VIRTIO_BT_F_AOSP_EXT   2       /* Indicates AOSP vendor support */
+#define VIRTIO_BT_F_CONFIG_V2  3       /* Use second version configuration */

 enum virtio_bt_config_type {
        VIRTIO_BT_CONFIG_TYPE_PRIMARY   = 0,
@@ -28,4 +29,11 @@  struct virtio_bt_config {
        __u16 msft_opcode;
 } __attribute__((packed));

+struct virtio_bt_config_v2 {
+       __u8  type;
+       __u8  alignment;
+       __u16 vendor;
+       __u16 msft_opcode;
+};
+
 #endif /* _UAPI_LINUX_VIRTIO_BT_H */