* [PATCH v3 0/6] Generic USB Display driver
From: Noralf Trønnes @ 2020-05-29 17:56 UTC (permalink / raw)
To: dri-devel, balbi; +Cc: linux-usb, sam
Hi,
A while back I had the idea to turn a Raspberry Pi Zero into a $5
USB to HDMI/SDTV/DSI/DPI display adapter.
This series adds a USB host driver and a device/gadget driver to achieve
that.
The reason for calling it 'Generic' is so anyone can make a USB
display/adapter against this driver, all that's needed is to add a USB
vid:pid. I have done a microcontroller implementation hack just to see
how that would work out[1] (which unconvered a couple of bugs in the
host driver).
The contents of the previous cover letter has been moved to the wiki[2]
since it was getting rather long.
I've made an image[3] with the gadget side set up for the Raspberry Pi
for easy testing. Patch 4 is the only one needed for the host side.
Merge plan
I'm hoping to apply the remaining drm_client patches in time for 5.9.
With that in place it's much easier to apply the patch for the USB
subsystem the following merge window (5.10). Doing both in the same
cycle is possible ofc, but due to the high rate of change in DRM this
_can_ turn out to be tricky. There's no hurry to get the gadget side
merged since I will provide images for the Raspberry Pi. The host driver
I hope to apply in time for 5.9.
Reviews and testing are very much welcome!
Changes since version 2:
- Use donated Openmoko USB pid: 1d50:614d
- Use direct compression from framebuffer when pitch matches, not only
on full frames, so split updates can benefit
- Use __le16 in struct gud_drm_req_get_connector_status
- Set edid property when the device only provides edid
- Clear compression fields in struct gud_drm_req_set_buffer
- Fix protocol version negotiation
- Remove mode->vrefresh, it's calculated
- drm_client_init_from_id(): remove locking
- Applied reviewed patches, thanks Sam.
Dependency:
- backlight: Add backlight_device_get_by_name()[4]
Noralf.
[1] https://github.com/notro/gud/tree/master/STM32F769I-DISCO
[2] https://github.com/notro/gud/wiki
[3] https://github.com/notro/gud/wiki/rpi-image
[4] https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git/commit/?h=for-backlight-next&id=479da1f538a2f3547e15f9d5922c611b69ec2fbc
Noralf Trønnes (6):
drm/client: Add drm_client_init_from_id()
drm/client: Add drm_client_modeset_disable()
drm/client: Add a way to set modeset, properties and rotation
drm: Add Generic USB Display driver
drm/gud: Add functionality for the USB gadget side
usb: gadget: function: Add Generic USB Display support
.../ABI/testing/configfs-usb-gadget-gud_drm | 10 +
MAINTAINERS | 10 +
drivers/gpu/drm/Kconfig | 2 +
drivers/gpu/drm/Makefile | 1 +
drivers/gpu/drm/drm_client.c | 44 +-
drivers/gpu/drm/drm_client_modeset.c | 157 +++
drivers/gpu/drm/gud/Kconfig | 20 +
drivers/gpu/drm/gud/Makefile | 5 +
drivers/gpu/drm/gud/gud_drm_connector.c | 726 ++++++++++
drivers/gpu/drm/gud/gud_drm_drv.c | 648 +++++++++
drivers/gpu/drm/gud/gud_drm_gadget.c | 1167 +++++++++++++++++
drivers/gpu/drm/gud/gud_drm_internal.h | 65 +
drivers/gpu/drm/gud/gud_drm_pipe.c | 426 ++++++
drivers/usb/gadget/Kconfig | 12 +
drivers/usb/gadget/function/Makefile | 2 +
drivers/usb/gadget/function/f_gud_drm.c | 678 ++++++++++
include/drm/drm_client.h | 43 +-
include/drm/gud_drm.h | 374 ++++++
18 files changed, 4387 insertions(+), 3 deletions(-)
create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-gud_drm
create mode 100644 drivers/gpu/drm/gud/Kconfig
create mode 100644 drivers/gpu/drm/gud/Makefile
create mode 100644 drivers/gpu/drm/gud/gud_drm_connector.c
create mode 100644 drivers/gpu/drm/gud/gud_drm_drv.c
create mode 100644 drivers/gpu/drm/gud/gud_drm_gadget.c
create mode 100644 drivers/gpu/drm/gud/gud_drm_internal.h
create mode 100644 drivers/gpu/drm/gud/gud_drm_pipe.c
create mode 100644 drivers/usb/gadget/function/f_gud_drm.c
create mode 100644 include/drm/gud_drm.h
--
2.23.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* [PATCH v3 3/6] drm/client: Add a way to set modeset, properties and rotation
From: Noralf Trønnes @ 2020-05-29 17:56 UTC (permalink / raw)
To: dri-devel, balbi; +Cc: linux-usb, sam, Noralf Trønnes
In-Reply-To: <20200529175643.46094-1-noralf@tronnes.org>
This adds functions for clients that need more control over the
configuration than what's setup by drm_client_modeset_probe().
Connector, fb and display mode can be set using drm_client_modeset_set().
Plane rotation can be set using drm_client_modeset_set_rotation() and
other properties using drm_client_modeset_set_property(). Property
setting is only implemented for atomic drivers.
v2:
- drm_client_modeset_set(): Remove undocumented functionality to clear
modesets. A disable function takes care of that need now.
- drm_client_modeset_set_property(): Return -EOPNOTSUPP if driver is not
atomic (Sam)
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
drivers/gpu/drm/drm_client_modeset.c | 137 +++++++++++++++++++++++++++
include/drm/drm_client.h | 38 +++++++-
2 files changed, 174 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index 977bcd063520..9eee9567b9aa 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -83,6 +83,10 @@ static void drm_client_modeset_release(struct drm_client_dev *client)
}
modeset->num_connectors = 0;
}
+
+ kfree(client->properties);
+ client->properties = NULL;
+ client->num_properties = 0;
}
void drm_client_modeset_free(struct drm_client_dev *client)
@@ -879,6 +883,130 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
}
EXPORT_SYMBOL(drm_client_modeset_probe);
+/**
+ * drm_client_modeset_set() - Set modeset configuration
+ * @client: DRM client
+ * @connector: Connector
+ * @mode: Display mode
+ * @fb: Framebuffer
+ *
+ * This function releases any current modeset info, including properties, and
+ * sets the new modeset in the client's modeset array.
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_modeset_set(struct drm_client_dev *client, struct drm_connector *connector,
+ struct drm_display_mode *mode, struct drm_framebuffer *fb)
+{
+ struct drm_mode_set *modeset;
+ int ret = -ENOENT;
+
+ mutex_lock(&client->modeset_mutex);
+
+ drm_client_modeset_release(client);
+
+ drm_client_for_each_modeset(modeset, client) {
+ if (!connector_has_possible_crtc(connector, modeset->crtc))
+ continue;
+
+ modeset->mode = drm_mode_duplicate(client->dev, mode);
+ if (!modeset->mode) {
+ ret = -ENOMEM;
+ break;
+ }
+
+ drm_mode_set_crtcinfo(modeset->mode, CRTC_INTERLACE_HALVE_V);
+
+ drm_connector_get(connector);
+ modeset->connectors[modeset->num_connectors++] = connector;
+
+ modeset->fb = fb;
+ ret = 0;
+ break;
+ }
+
+ mutex_unlock(&client->modeset_mutex);
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_client_modeset_set);
+
+/**
+ * drm_client_modeset_set_property() - Set a property on the current configuration
+ * @client: DRM client
+ * @obj: DRM Mode Object
+ * @prop: DRM Property
+ * @value: Property value
+ *
+ * Note: Currently only implemented for atomic drivers.
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_modeset_set_property(struct drm_client_dev *client, struct drm_mode_object *obj,
+ struct drm_property *prop, u64 value)
+{
+ struct drm_client_property *properties;
+ int ret = 0;
+
+ if (!prop)
+ return -EINVAL;
+
+ if (!drm_drv_uses_atomic_modeset(client->dev))
+ return -EOPNOTSUPP;
+
+ mutex_lock(&client->modeset_mutex);
+
+ properties = krealloc(client->properties,
+ (client->num_properties + 1) * sizeof(*properties), GFP_KERNEL);
+ if (!properties) {
+ ret = -ENOMEM;
+ goto unlock;
+ }
+
+ properties[client->num_properties].obj = obj;
+ properties[client->num_properties].prop = prop;
+ properties[client->num_properties].value = value;
+ client->properties = properties;
+ client->num_properties++;
+unlock:
+ mutex_unlock(&client->modeset_mutex);
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_client_modeset_set_property);
+
+/**
+ * drm_client_modeset_set_rotation() - Set rotation on the current configuration
+ * @client: DRM client
+ * @value: Rotation value
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_modeset_set_rotation(struct drm_client_dev *client, u64 value)
+{
+ struct drm_plane *plane = NULL;
+ struct drm_mode_set *modeset;
+
+ mutex_lock(&client->modeset_mutex);
+ drm_client_for_each_modeset(modeset, client) {
+ if (modeset->mode) {
+ plane = modeset->crtc->primary;
+ break;
+ }
+ }
+ mutex_unlock(&client->modeset_mutex);
+
+ if (!plane)
+ return -ENOENT;
+
+ return drm_client_modeset_set_property(client, &plane->base,
+ plane->rotation_property, value);
+}
+EXPORT_SYMBOL(drm_client_modeset_set_rotation);
+
/**
* drm_client_rotation() - Check the initial rotation value
* @modeset: DRM modeset
@@ -973,6 +1101,7 @@ static int drm_client_modeset_commit_atomic(struct drm_client_dev *client, bool
struct drm_atomic_state *state;
struct drm_modeset_acquire_ctx ctx;
struct drm_mode_set *mode_set;
+ unsigned int i;
int ret;
drm_modeset_acquire_init(&ctx, 0);
@@ -1033,6 +1162,14 @@ static int drm_client_modeset_commit_atomic(struct drm_client_dev *client, bool
}
}
+ for (i = 0; i < client->num_properties; i++) {
+ struct drm_client_property *prop = &client->properties[i];
+
+ ret = drm_atomic_set_property(state, NULL, prop->obj, prop->prop, prop->value);
+ if (ret)
+ goto out_state;
+ }
+
if (check)
ret = drm_atomic_check_only(state);
else
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
index 498089b647da..bdcdc30519e6 100644
--- a/include/drm/drm_client.h
+++ b/include/drm/drm_client.h
@@ -16,6 +16,7 @@ struct drm_file;
struct drm_framebuffer;
struct drm_gem_object;
struct drm_minor;
+struct drm_property;
struct module;
/**
@@ -64,6 +65,26 @@ struct drm_client_funcs {
int (*hotplug)(struct drm_client_dev *client);
};
+/**
+ * struct drm_client_property - DRM client property
+ */
+struct drm_client_property {
+ /**
+ * @obj: DRM Mode Object to which the property belongs.
+ */
+ struct drm_mode_object *obj;
+
+ /**
+ * @prop: DRM Property.
+ */
+ struct drm_property *prop;
+
+ /**
+ * @value: Property value.
+ */
+ u64 value;
+};
+
/**
* struct drm_client_dev - DRM client instance
*/
@@ -97,7 +118,7 @@ struct drm_client_dev {
struct drm_file *file;
/**
- * @modeset_mutex: Protects @modesets.
+ * @modeset_mutex: Protects @modesets and @properties.
*/
struct mutex modeset_mutex;
@@ -105,6 +126,16 @@ struct drm_client_dev {
* @modesets: CRTC configurations
*/
struct drm_mode_set *modesets;
+
+ /**
+ * @properties: DRM properties attached to the configuration.
+ */
+ struct drm_client_property *properties;
+
+ /**
+ * @num_properties: Number of attached properties.
+ */
+ unsigned int num_properties;
};
int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
@@ -163,6 +194,11 @@ void drm_client_buffer_vunmap(struct drm_client_buffer *buffer);
int drm_client_modeset_create(struct drm_client_dev *client);
void drm_client_modeset_free(struct drm_client_dev *client);
int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int height);
+int drm_client_modeset_set(struct drm_client_dev *client, struct drm_connector *connector,
+ struct drm_display_mode *mode, struct drm_framebuffer *fb);
+int drm_client_modeset_set_property(struct drm_client_dev *client, struct drm_mode_object *obj,
+ struct drm_property *prop, u64 value);
+int drm_client_modeset_set_rotation(struct drm_client_dev *client, u64 value);
bool drm_client_rotation(struct drm_mode_set *modeset, unsigned int *rotation);
int drm_client_modeset_check(struct drm_client_dev *client);
int drm_client_modeset_commit_locked(struct drm_client_dev *client);
--
2.23.0
^ permalink raw reply related
* [PATCH v3 0/6] Generic USB Display driver
From: Noralf Trønnes @ 2020-05-29 17:56 UTC (permalink / raw)
To: dri-devel, balbi; +Cc: linux-usb, sam, Noralf Trønnes
Hi,
A while back I had the idea to turn a Raspberry Pi Zero into a $5
USB to HDMI/SDTV/DSI/DPI display adapter.
This series adds a USB host driver and a device/gadget driver to achieve
that.
The reason for calling it 'Generic' is so anyone can make a USB
display/adapter against this driver, all that's needed is to add a USB
vid:pid. I have done a microcontroller implementation hack just to see
how that would work out[1] (which unconvered a couple of bugs in the
host driver).
The contents of the previous cover letter has been moved to the wiki[2]
since it was getting rather long.
I've made an image[3] with the gadget side set up for the Raspberry Pi
for easy testing. Patch 4 is the only one needed for the host side.
Merge plan
I'm hoping to apply the remaining drm_client patches in time for 5.9.
With that in place it's much easier to apply the patch for the USB
subsystem the following merge window (5.10). Doing both in the same
cycle is possible ofc, but due to the high rate of change in DRM this
_can_ turn out to be tricky. There's no hurry to get the gadget side
merged since I will provide images for the Raspberry Pi. The host driver
I hope to apply in time for 5.9.
Reviews and testing are very much welcome!
Changes since version 2:
- Use donated Openmoko USB pid: 1d50:614d
- Use direct compression from framebuffer when pitch matches, not only
on full frames, so split updates can benefit
- Use __le16 in struct gud_drm_req_get_connector_status
- Set edid property when the device only provides edid
- Clear compression fields in struct gud_drm_req_set_buffer
- Fix protocol version negotiation
- Remove mode->vrefresh, it's calculated
- drm_client_init_from_id(): remove locking
- Applied reviewed patches, thanks Sam.
Dependency:
- backlight: Add backlight_device_get_by_name()[4]
Noralf.
[1] https://github.com/notro/gud/tree/master/STM32F769I-DISCO
[2] https://github.com/notro/gud/wiki
[3] https://github.com/notro/gud/wiki/rpi-image
[4] https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git/commit/?h=for-backlight-next&id=479da1f538a2f3547e15f9d5922c611b69ec2fbc
Noralf Trønnes (6):
drm/client: Add drm_client_init_from_id()
drm/client: Add drm_client_modeset_disable()
drm/client: Add a way to set modeset, properties and rotation
drm: Add Generic USB Display driver
drm/gud: Add functionality for the USB gadget side
usb: gadget: function: Add Generic USB Display support
.../ABI/testing/configfs-usb-gadget-gud_drm | 10 +
MAINTAINERS | 10 +
drivers/gpu/drm/Kconfig | 2 +
drivers/gpu/drm/Makefile | 1 +
drivers/gpu/drm/drm_client.c | 44 +-
drivers/gpu/drm/drm_client_modeset.c | 157 +++
drivers/gpu/drm/gud/Kconfig | 20 +
drivers/gpu/drm/gud/Makefile | 5 +
drivers/gpu/drm/gud/gud_drm_connector.c | 726 ++++++++++
drivers/gpu/drm/gud/gud_drm_drv.c | 648 +++++++++
drivers/gpu/drm/gud/gud_drm_gadget.c | 1167 +++++++++++++++++
drivers/gpu/drm/gud/gud_drm_internal.h | 65 +
drivers/gpu/drm/gud/gud_drm_pipe.c | 426 ++++++
drivers/usb/gadget/Kconfig | 12 +
drivers/usb/gadget/function/Makefile | 2 +
drivers/usb/gadget/function/f_gud_drm.c | 678 ++++++++++
include/drm/drm_client.h | 43 +-
include/drm/gud_drm.h | 374 ++++++
18 files changed, 4387 insertions(+), 3 deletions(-)
create mode 100644 Documentation/ABI/testing/configfs-usb-gadget-gud_drm
create mode 100644 drivers/gpu/drm/gud/Kconfig
create mode 100644 drivers/gpu/drm/gud/Makefile
create mode 100644 drivers/gpu/drm/gud/gud_drm_connector.c
create mode 100644 drivers/gpu/drm/gud/gud_drm_drv.c
create mode 100644 drivers/gpu/drm/gud/gud_drm_gadget.c
create mode 100644 drivers/gpu/drm/gud/gud_drm_internal.h
create mode 100644 drivers/gpu/drm/gud/gud_drm_pipe.c
create mode 100644 drivers/usb/gadget/function/f_gud_drm.c
create mode 100644 include/drm/gud_drm.h
--
2.23.0
^ permalink raw reply
* [PATCH v3 1/6] drm/client: Add drm_client_init_from_id()
From: Noralf Trønnes @ 2020-05-29 17:56 UTC (permalink / raw)
To: dri-devel, balbi; +Cc: linux-usb, sam, Noralf Trønnes
In-Reply-To: <20200529175643.46094-1-noralf@tronnes.org>
drm_client_init_from_id() provides a way for clients to add a client based
on the minor. drm_client_register() is changed to return whether it was
registered or not depending on the unplugged status of the DRM device.
Its only caller drm_fbdev_generic_setup() runs inside probe() so it
doesn't have to check.
v2:
- Move drm_client_modeset_set() to a separate patch with added functions.
- Previous version had drm_client_init_from_id() call
drm_client_register(). This put the client in a position where it could
receive hotplugs during init in addition to akward error paths. Instead
let drm_client_register() return status so clients can know if the DRM
device is gone or not.
v3:
- Forgot to remove locking with the change in the previous version.
No need for locking when drm_client_register() is not called.
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
drivers/gpu/drm/drm_client.c | 44 +++++++++++++++++++++++++++++++++++-
include/drm/drm_client.h | 4 +++-
2 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index 8f3d08dc996d..b7a310fef7e2 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -112,6 +112,36 @@ int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
}
EXPORT_SYMBOL(drm_client_init);
+/**
+ * drm_client_init_from_id - Initialise a DRM client
+ * @minor_id: DRM minor id
+ * @client: DRM client
+ * @name: Client name
+ * @funcs: DRM client functions (optional)
+ *
+ * This function looks up the drm_device using the minor id and initializes the
+ * client using drm_client_init().
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_init_from_id(unsigned int minor_id, struct drm_client_dev *client,
+ const char *name, const struct drm_client_funcs *funcs)
+{
+ struct drm_minor *minor;
+ int ret;
+
+ minor = drm_minor_acquire(minor_id);
+ if (IS_ERR(minor))
+ return PTR_ERR(minor);
+
+ ret = drm_client_init(minor->dev, client, name, funcs);
+ drm_minor_release(minor);
+
+ return ret;
+}
+EXPORT_SYMBOL(drm_client_init_from_id);
+
/**
* drm_client_register - Register client
* @client: DRM client
@@ -121,14 +151,26 @@ EXPORT_SYMBOL(drm_client_init);
* drm_client_register() it is no longer permissible to call drm_client_release()
* directly (outside the unregister callback), instead cleanup will happen
* automatically on driver unload.
+ *
+ * Returns:
+ * True if the client has been registered, false if the DRM device has already
+ * been unregistered.
*/
-void drm_client_register(struct drm_client_dev *client)
+bool drm_client_register(struct drm_client_dev *client)
{
struct drm_device *dev = client->dev;
+ int idx;
+
+ if (!drm_dev_enter(client->dev, &idx))
+ return false;
mutex_lock(&dev->clientlist_mutex);
list_add(&client->list, &dev->clientlist);
mutex_unlock(&dev->clientlist_mutex);
+
+ drm_dev_exit(idx);
+
+ return true;
}
EXPORT_SYMBOL(drm_client_register);
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
index 9f5a36a8ef24..76704f48fc46 100644
--- a/include/drm/drm_client.h
+++ b/include/drm/drm_client.h
@@ -109,8 +109,10 @@ struct drm_client_dev {
int drm_client_init(struct drm_device *dev, struct drm_client_dev *client,
const char *name, const struct drm_client_funcs *funcs);
+int drm_client_init_from_id(unsigned int minor_id, struct drm_client_dev *client,
+ const char *name, const struct drm_client_funcs *funcs);
void drm_client_release(struct drm_client_dev *client);
-void drm_client_register(struct drm_client_dev *client);
+bool drm_client_register(struct drm_client_dev *client);
void drm_client_dev_unregister(struct drm_device *dev);
void drm_client_dev_hotplug(struct drm_device *dev);
--
2.23.0
^ permalink raw reply related
* [PATCH v3 2/6] drm/client: Add drm_client_modeset_disable()
From: Noralf Trønnes @ 2020-05-29 17:56 UTC (permalink / raw)
To: dri-devel, balbi; +Cc: linux-usb, sam, Noralf Trønnes
In-Reply-To: <20200529175643.46094-1-noralf@tronnes.org>
Add a way for clients to disable all outputs.
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
---
drivers/gpu/drm/drm_client_modeset.c | 20 ++++++++++++++++++++
include/drm/drm_client.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index 27e2fb41f14d..977bcd063520 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -1225,3 +1225,23 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode)
return ret;
}
EXPORT_SYMBOL(drm_client_modeset_dpms);
+
+/**
+ * drm_client_modeset_disable() - Disable all outputs
+ * @client: DRM client
+ *
+ * This function disables all outputs by first clearing the modeset array and
+ * then committing the empty modesets.
+ *
+ * Returns:
+ * Zero on success or negative error code on failure.
+ */
+int drm_client_modeset_disable(struct drm_client_dev *client)
+{
+ mutex_lock(&client->modeset_mutex);
+ drm_client_modeset_release(client);
+ mutex_unlock(&client->modeset_mutex);
+
+ return drm_client_modeset_commit(client);
+}
+EXPORT_SYMBOL(drm_client_modeset_disable);
diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
index 76704f48fc46..498089b647da 100644
--- a/include/drm/drm_client.h
+++ b/include/drm/drm_client.h
@@ -168,6 +168,7 @@ int drm_client_modeset_check(struct drm_client_dev *client);
int drm_client_modeset_commit_locked(struct drm_client_dev *client);
int drm_client_modeset_commit(struct drm_client_dev *client);
int drm_client_modeset_dpms(struct drm_client_dev *client, int mode);
+int drm_client_modeset_disable(struct drm_client_dev *client);
/**
* drm_client_for_each_modeset() - Iterate over client modesets
--
2.23.0
^ permalink raw reply related
* Re: [PATCH net] sch_cake: Take advantage of skb->hash where appropriate
From: Jakub Kicinski @ 2020-05-29 17:57 UTC (permalink / raw)
To: Toke Høiland-Jørgensen; +Cc: davem, netdev, cake
In-Reply-To: <20200529124344.355785-1-toke@redhat.com>
On Fri, 29 May 2020 14:43:44 +0200 Toke Høiland-Jørgensen wrote:
> + * enabled there's another check below after doing the conntrack lookup.
> + */
nit: alignment
^ permalink raw reply
* [PATCH v2] hwmon:(adm1275) Enable adm1278 ADM1278_TEMP1_EN
From: Vijay Khemka @ 2020-05-29 17:57 UTC (permalink / raw)
To: linux-aspeed
In-Reply-To: <20200529124607.GA3469@cnn>
?On 5/29/20, 5:47 AM, "Manikandan Elumalai" <manikandan.hcl.ers.epl@gmail.com> wrote:
The adm1278 temperature sysfs attribute need it for one of the openbmc platform .
This functionality is not enabled by default, so PMON_CONFIG needs to be modified in order to enable it.
Signed-off-by : Manikandan Elumalai <manikandan.hcl.ers.epl@gmail.com>
v2:
- Add Signed-off-by.
- Removed ADM1278_TEMP1_EN check.
---
drivers/hwmon/pmbus/adm1275.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/hwmon/pmbus/adm1275.c b/drivers/hwmon/pmbus/adm1275.c
index 5caa37fb..ab5fceb 100644
--- a/drivers/hwmon/pmbus/adm1275.c
+++ b/drivers/hwmon/pmbus/adm1275.c
@@ -666,7 +666,23 @@ static int adm1275_probe(struct i2c_client *client,
tindex = 3;
info->func[0] |= PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT |
- PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT;
+ PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_VOUT |
+ PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
+
+ config = i2c_smbus_read_byte_data(client, ADM1275_PMON_CONFIG);
+ if (config < 0)
+ return config;
+
+ /* Enable TEMP1 by default */
+ config |= ADM1278_TEMP1_EN;
+ ret = i2c_smbus_write_byte_data(client,
+ ADM1275_PMON_CONFIG,
+ config);
+ if (ret < 0) {
+ dev_err(&client->dev,
+ "Failed to enable temperature config\n");
+ return -ENODEV;
+ }
You don't need this above code removing check as below should be enough to
populate sysfs entry you need.
/* Enable VOUT if not enabled (it is disabled by default) */
if (!(config & ADM1278_VOUT_EN)) {
@@ -681,9 +697,6 @@ static int adm1275_probe(struct i2c_client *client,
}
}
- if (config & ADM1278_TEMP1_EN)
- info->func[0] |=
- PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP;
if (config & ADM1278_VIN_EN)
info->func[0] |= PMBUS_HAVE_VIN;
break;
--
2.7.4
^ permalink raw reply
* Re: [PATCH] net/sched: act_ct: add nat mangle action only for NAT-conntrack
From: Marcelo Ricardo Leitner @ 2020-05-29 17:56 UTC (permalink / raw)
To: wenxu; +Cc: paulb, netdev, davem
In-Reply-To: <1590725265-17136-1-git-send-email-wenxu@ucloud.cn>
On Fri, May 29, 2020 at 12:07:45PM +0800, wenxu@ucloud.cn wrote:
> From: wenxu <wenxu@ucloud.cn>
>
> Currently add nat mangle action with comparing invert and ori tuple.
> It is better to check IPS_NAT_MASK flags first to avoid non necessary
> memcmp for non-NAT conntrack.
>
> Signed-off-by: wenxu <wenxu@ucloud.cn>
> ---
> net/sched/act_ct.c | 19 +++++++++++++------
> 1 file changed, 13 insertions(+), 6 deletions(-)
>
> diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
> index c50a86a..d621152 100644
> --- a/net/sched/act_ct.c
> +++ b/net/sched/act_ct.c
> @@ -198,18 +198,21 @@ static int tcf_ct_flow_table_add_action_nat(struct net *net,
> struct flow_action *action)
> {
> const struct nf_conntrack_tuple *tuple = &ct->tuplehash[dir].tuple;
> + bool nat = ct->status & IPS_NAT_MASK;
> struct nf_conntrack_tuple target;
[A]
>
> nf_ct_invert_tuple(&target, &ct->tuplehash[!dir].tuple);
>
> switch (tuple->src.l3num) {
> case NFPROTO_IPV4:
> - tcf_ct_flow_table_add_action_nat_ipv4(tuple, target,
> - action);
> + if (nat)
Why do the same check multiple times, on all actions? As no other
action is performed if not doing a nat, seems at [A] above, it could
just:
if (!nat)
return 0;
> + tcf_ct_flow_table_add_action_nat_ipv4(tuple, target,
> + action);
> break;
> case NFPROTO_IPV6:
> - tcf_ct_flow_table_add_action_nat_ipv6(tuple, target,
> - action);
> + if (nat)
> + tcf_ct_flow_table_add_action_nat_ipv6(tuple, target,
> + action);
> break;
> default:
> return -EOPNOTSUPP;
> @@ -217,10 +220,14 @@ static int tcf_ct_flow_table_add_action_nat(struct net *net,
>
> switch (nf_ct_protonum(ct)) {
> case IPPROTO_TCP:
> - tcf_ct_flow_table_add_action_nat_tcp(tuple, target, action);
> + if (nat)
> + tcf_ct_flow_table_add_action_nat_tcp(tuple, target,
> + action);
> break;
> case IPPROTO_UDP:
> - tcf_ct_flow_table_add_action_nat_udp(tuple, target, action);
> + if (nat)
> + tcf_ct_flow_table_add_action_nat_udp(tuple, target,
> + action);
> break;
> default:
> return -EOPNOTSUPP;
> --
> 1.8.3.1
>
^ permalink raw reply
* Re: [PATCH 06/30] KVM: SVM: always update CR3 in VMCB
From: Sean Christopherson @ 2020-05-29 17:56 UTC (permalink / raw)
To: Krish Sadhukhan; +Cc: Paolo Bonzini, linux-kernel, kvm
In-Reply-To: <07139fc2-39bd-5bc5-ef23-a98681013665@oracle.com>
On Fri, May 29, 2020 at 10:41:58AM -0700, Krish Sadhukhan wrote:
>
> On 5/29/20 8:39 AM, Paolo Bonzini wrote:
> >svm_load_mmu_pgd is delaying the write of GUEST_CR3 to prepare_vmcs02
>
> Did you mean to say enter_svm_guest_mode here ?
Heh, looks like Vitaly passed the s/vmcs/vmcb bug on to Paolo, too. :-D
^ permalink raw reply
* Re: pinctrl-single: num_maps in generic pinconf support?
From: Drew Fustini @ 2020-05-29 17:55 UTC (permalink / raw)
To: Haojian Zhuang, Linus Walleij; +Cc: Tony Lindgren, linux-omap, linux-gpio
In-Reply-To: <20200526122133.GA1454440@x1>
On Tue, May 26, 2020 at 02:21:33PM +0200, Drew Fustini wrote:
> Hello Haojian and Linus,
>
> For pcs_parse_one_pinctrl_entry() in drivers/pinctrl/pinctrl-single.c,
> I see that num_maps is set to 2 if PCS_HAS_PINCONF is enabled:
>
> 1057 if (PCS_HAS_PINCONF && function) {
> 1058 res = pcs_parse_pinconf(pcs, np, function, map);
> 1059 if (res)
> 1060 goto free_pingroups;
> 1061 *num_maps = 2;
> 1062 } else {
> 1063 *num_maps = 1;
> 1064 }
> 1065 mutex_unlock(&pcs->mutex);
>
> git blame shows me that came from 9dddb4df90d13:
> "pinctrl: single: support generic pinconf"
>
> Would you be able to provide any insight as to num_maps needs to be 2
> when pinconf is enabled?
>
> thank you,
> drew
The BeagleBone fails to boot when I change the am33xx_pinmux compatible
from "pinctrl,single" to "pinconf,single":
diff --git a/arch/arm/boot/dts/am33xx-l4.dtsi b/arch/arm/boot/dts/am33xx-l4.dtsi
index 5ed7f3c58c0f..b5bedd776ee6 100644
--- a/arch/arm/boot/dts/am33xx-l4.dtsi
+++ b/arch/arm/boot/dts/am33xx-l4.dtsi
@@ -276,7 +276,7 @@ scm: scm@0 {
ranges = <0 0 0x2000>;
am33xx_pinmux: pinmux@800 {
- compatible = "pinctrl-single";
+ compatible = "pinconf-single";
reg = <0x800 0x238>;
#pinctrl-cells = <1>;
pinctrl-single,register-width = <32>;
From the full dmesg output [0], these lines seem the most relevant:
[ 2.974958] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[ 3.847475] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0x160 value: 0x2f
[ 3.855556] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0xfc value: 0x30
[ 3.863520] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0xf8 value: 0x30
[ 3.871483] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0xf4 value: 0x30
[ 3.879444] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0xf0 value: 0x30
[ 3.887404] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0x104 value: 0x30
[ 3.895455] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0x100 value: 0x30
[ 3.903505] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0x1a0 value: 0x2c
[ 3.911583] pinctrl core: add 2 pinctrl maps
[ 3.915976] pinctrl core: failed to register map default (1): invalid type given
[ 3.923594] omap_hsmmc: probe of 48060000.mmc failed with error -22
[ 3.930403] omap_hsmmc 47810000.mmc: GPIO lookup for consumer cd
[ 4.440389] Waiting for root device /dev/mmcblk0p1...
The error message:
"pinctrl core: failed to register map default (1): invalid type given"
comes from drivers/pinctrl/core.c:
1387 int pinctrl_register_mappings(const struct pinctrl_map *maps,
1388 unsigned num_maps)
1389 {
1390 int i, ret;
1391 struct pinctrl_maps *maps_node;
1392
1393 pr_debug("add %u pinctrl maps\n", num_maps);
1394
1395 /* First sanity check the new mapping */
1396 for (i = 0; i < num_maps; i++) {
<snip>
1416 switch (maps[i].type) {
1417 case PIN_MAP_TYPE_DUMMY_STATE:
1418 break;
1419 case PIN_MAP_TYPE_MUX_GROUP:
1420 ret = pinmux_validate_map(&maps[i], i);
1421 if (ret < 0)
1422 return ret;
1423 break;
1424 case PIN_MAP_TYPE_CONFIGS_PIN:
1425 case PIN_MAP_TYPE_CONFIGS_GROUP:
1426 ret = pinconf_validate_map(&maps[i], i);
1427 if (ret < 0)
1428 return ret;
1429 break;
1430 default:
1431 pr_err("failed to register map %s (%d): invalid type given\n",
1432 maps[i].name, i);
1433 return -EINVAL;
1434 }
1435 }
The invalid type error occurs when maps[i].type does not match any of
the case statements.
I have determined the system will boot ok [1] when num_maps is forced
to be 1. Here are the related dmesg lines:
[ 3.920484] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0x160 value: 0x2f
[ 3.928420] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0xfc value: 0x30
[ 3.936224] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0xf8 value: 0x30
[ 3.944026] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0xf4 value: 0x30
[ 3.951826] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0xf0 value: 0x30
[ 3.959627] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0x104 value: 0x30
[ 3.967515] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0x100 value: 0x30
[ 3.975403] pinctrl-single 44e10800.pinmux: pinmux-mmc0-pins index: 0x1a0 value: 0x2c
[ 3.983318] pinctrl core: add 1 pinctrl maps
[ 3.987653] pinctrl-single 44e10800.pinmux: found group selector 4 for pinmux-mmc0-pins
[ 3.995723] pinctrl-single 44e10800.pinmux: request pin 88 (PIN88) for 48060000.mmc
[ 4.003434] pinctrl-single 44e10800.pinmux: request pin 63 (PIN63) for 48060000.mmc
[ 4.011141] pinctrl-single 44e10800.pinmux: request pin 62 (PIN62) for 48060000.mmc
[ 4.018847] pinctrl-single 44e10800.pinmux: request pin 61 (PIN61) for 48060000.mmc
[ 4.026633] pinctrl-single 44e10800.pinmux: request pin 60 (PIN60) for 48060000.mmc
[ 4.034351] pinctrl-single 44e10800.pinmux: request pin 65 (PIN65) for 48060000.mmc
[ 4.042065] pinctrl-single 44e10800.pinmux: request pin 64 (PIN64) for 48060000.mmc
[ 4.049774] pinctrl-single 44e10800.pinmux: request pin 104 (PIN104) for 48060000.mmc
[ 4.057662] pinctrl-single 44e10800.pinmux: enabling (null) function4
Here is the patch for num_maps:
diiff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 1e0614daee9b..78a93336c711 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1058,7 +1058,7 @@ static int pcs_parse_one_pinctrl_entry(struct pcs_device *pcs,
res = pcs_parse_pinconf(pcs, np, function, map);
if (res)
goto free_pingroups;
- *num_maps = 2;
+ *num_maps = 1;
} else {
*num_maps = 1;
}
I am trying to understand why num_maps is supposed to be 2 when
PCS_HAS_PINCONF, and I would appreciate any comments.
Is there a bug somewhere in the code?
Or, is it supposed to be invalid to enable "pinconf,single" compatible
for the am33xx_pinmux node?
thank you,
drew
[0] https://gist.github.com/pdp7/293716fe98d90f031bb75950803952a1
[1] https://gist.github.com/pdp7/fc5186f46e34c3acc1b1a169be85d3a9
^ permalink raw reply related
* Re: [bug report] refperf: Dynamically allocate experiment-summary output buffer
From: Joel Fernandes @ 2020-05-29 17:55 UTC (permalink / raw)
To: Dan Carpenter; +Cc: paulmck, rcu
In-Reply-To: <20200529094829.GA1302781@mwanda>
On Fri, May 29, 2020 at 12:48:29PM +0300, Dan Carpenter wrote:
> Hello Paul E. McKenney,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 54c0ed208976: "refperf: Dynamically allocate
> experiment-summary output buffer" from May 25, 2020, leads to the
> following Smatch complaint:
>
> kernel/rcu/refperf.c:395 main_func()
> error: we previously assumed 'buf' could be null (see line 352)
>
> kernel/rcu/refperf.c
> 351 buf = kzalloc(64 + nruns * 32, GFP_KERNEL);
> 352 if (!result_avg || !buf) {
> ^^^^
> Check for NULL
Makes sense. Looks like Paul already fixed it so should be good.
Thanks!
^ permalink raw reply
* Re: [PATCH] vfio/mdev: Fix reference count leak in add_mdev_supported_type.
From: Kirti Wankhede @ 2020-05-29 17:55 UTC (permalink / raw)
To: Cornelia Huck, wu000273
Cc: kjlu, Alex Williamson, Neo Jia, Dong Jia Shi, Jike Song, kvm,
linux-kernel
In-Reply-To: <20200528090220.6dc94bd7.cohuck@redhat.com>
On 5/28/2020 12:32 PM, Cornelia Huck wrote:
> On Wed, 27 May 2020 21:01:09 -0500
> wu000273@umn.edu wrote:
>
>> From: Qiushi Wu <wu000273@umn.edu>
>>
>> kobject_init_and_add() takes reference even when it fails.
>> If this function returns an error, kobject_put() must be called to
>> properly clean up the memory associated with the object. Thus,
>> replace kfree() by kobject_put() to fix this issue. Previous
>> commit "b8eb718348b8" fixed a similar problem.
>>
>> Fixes: 7b96953bc640 ("vfio: Mediated device Core driver")
>> Signed-off-by: Qiushi Wu <wu000273@umn.edu>
>> ---
>> drivers/vfio/mdev/mdev_sysfs.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Cornelia Huck <cohuck@redhat.com>
>
Thanks for fixing.
Reviewed-by: Kirti Wankhede <kwankhede@nvidia.com>
^ permalink raw reply
* Re: [PATCH v3 2/6] hwmon: (pmbus/core) Add Block WR
From: Guenter Roeck @ 2020-05-29 17:55 UTC (permalink / raw)
To: alexandru.tachici, linux-hwmon, linux-kernel, devicetree; +Cc: robh+dt
In-Reply-To: <20200529130506.73511-3-alexandru.tachici@analog.com>
On 5/29/20 6:05 AM, alexandru.tachici@analog.com wrote:
> From: Alexandru Tachici <alexandru.tachici@analog.com>
>
> PmBus devices support Block Write-Block Read Process
> Call described in SMBus specification v 2.0 with the
> exception that Block writes and reads are permitted to
> have up 255 data bytes instead of max 32 bytes (SMBus).
>
> This patch adds Block WR process call support for PMBus.
>
I don't think I want to have this code in the PMBus core.
We can move it there if needed at some point in the future,
but for the time being I'd rather have it in the driver
needing it.
> Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com>
> ---
> drivers/hwmon/pmbus/Kconfig | 2 +-
> drivers/hwmon/pmbus/pmbus.h | 4 ++
> drivers/hwmon/pmbus/pmbus_core.c | 88 ++++++++++++++++++++++++++++++++
> 3 files changed, 93 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
> index 6949483aa732..f11712fdcea8 100644
> --- a/drivers/hwmon/pmbus/Kconfig
> +++ b/drivers/hwmon/pmbus/Kconfig
> @@ -5,7 +5,7 @@
>
> menuconfig PMBUS
> tristate "PMBus support"
> - depends on I2C
> + depends on I2C && CRC8
This should be select CRC8, not depends.
> help
> Say yes here if you want to enable PMBus support.
>
> diff --git a/drivers/hwmon/pmbus/pmbus.h b/drivers/hwmon/pmbus/pmbus.h
> index 18e06fc6c53f..ae4e15c5dff2 100644
> --- a/drivers/hwmon/pmbus/pmbus.h
> +++ b/drivers/hwmon/pmbus/pmbus.h
> @@ -392,6 +392,8 @@ enum pmbus_sensor_classes {
> #define PMBUS_PHASE_VIRTUAL BIT(30) /* Phases on this page are virtual */
> #define PMBUS_PAGE_VIRTUAL BIT(31) /* Page is virtual */
>
> +#define PMBUS_BLOCK_MAX 255
> +
> enum pmbus_data_format { linear = 0, direct, vid };
> enum vrm_version { vr11 = 0, vr12, vr13, imvp9, amd625mv };
>
> @@ -467,6 +469,8 @@ int pmbus_read_word_data(struct i2c_client *client, int page, int phase,
> u8 reg);
> int pmbus_write_word_data(struct i2c_client *client, int page, u8 reg,
> u16 word);
> +int pmbus_block_wr(struct i2c_client *client, u8 cmd, u8 w_len, u8 *data_w,
> + u8 *data_r);
> int pmbus_read_byte_data(struct i2c_client *client, int page, u8 reg);
> int pmbus_write_byte(struct i2c_client *client, int page, u8 value);
> int pmbus_write_byte_data(struct i2c_client *client, int page, u8 reg,
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 8d321bf7d15b..ef63468da3b5 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -6,6 +6,7 @@
> * Copyright (c) 2012 Guenter Roeck
> */
>
> +#include <linux/crc8.h>
> #include <linux/debugfs.h>
> #include <linux/kernel.h>
> #include <linux/math64.h>
> @@ -44,6 +45,8 @@
>
> #define PMBUS_NAME_SIZE 24
>
> +DECLARE_CRC8_TABLE(pmbus_crc_table);
> +
> struct pmbus_sensor {
> struct pmbus_sensor *next;
> char name[PMBUS_NAME_SIZE]; /* sysfs sensor name */
> @@ -184,6 +187,89 @@ int pmbus_set_page(struct i2c_client *client, int page, int phase)
> }
> EXPORT_SYMBOL_GPL(pmbus_set_page);
>
> +/* Block Write/Read command.
I won't accept network-style multi-line comments.
> + * @client: Handle to slave device
> + * @cmd: Byte interpreted by slave
> + * @w_len: Size of write data block; PMBus allows at most 255 bytes
> + * @data_w: byte array which will be written.
> + * @data_r: Byte array into which data will be read; big enough to hold
> + * the data returned by the slave. PMBus allows at most 255 bytes.
> + *
> + * Different from Block Read as it sends data and waits for the slave to
> + * return a value dependent on that data. The protocol is simply a Write Block
> + * followed by a Read Block without the Read-Block command field and the
> + * Write-Block STOP bit.
> + *
> + * Returns number of bytes read or negative errno.
> + */
> +int pmbus_block_wr(struct i2c_client *client, u8 cmd, u8 w_len,
_wr is misleading, since it suggests an abbreviated _write.
Better use something like _transfer or _xfer.
> + u8 *data_w, u8 *data_r)
> +{
> + u8 write_buf[PMBUS_BLOCK_MAX + 1];
> + struct i2c_msg msgs[2] = {
> + {
> + .addr = client->addr,
> + .flags = 0,
> + .buf = write_buf,
> + .len = w_len + 2,
> + },
> + {
> + .addr = client->addr,
> + .flags = I2C_M_RD,
> + .len = PMBUS_BLOCK_MAX,
> + }
> + };
> + u8 addr = 0;
> + u8 crc = 0;
> + int ret;
> +
> + msgs[0].buf[0] = cmd;
> + msgs[0].buf[1] = w_len;
> + memcpy(&msgs[0].buf[2], data_w, w_len);
> +
w_len can be up to 255, meaning up to 255 + 2 bytes can be written
into write_buf. Yet, write_buf is only 256 bytes long.
> + msgs[0].buf = i2c_get_dma_safe_msg_buf(&msgs[0], 1);
> + if (!msgs[0].buf)
> + return -ENOMEM;
> +
> + msgs[1].buf = i2c_get_dma_safe_msg_buf(&msgs[1], 1);
> + if (!msgs[1].buf) {
> + i2c_put_dma_safe_msg_buf(msgs[0].buf, &msgs[0], false);
> + return -ENOMEM;
> + }
> +
> + ret = i2c_transfer(client->adapter, msgs, 2);
> + if (ret != 2) {
> + dev_err(&client->dev, "I2C transfer error.");
ret may be 1, which would suggest to the caller that one byte
of data was returned. Also, I am not in favor of logging noise.
> + goto cleanup;
> + }
> +
> + if (client->flags & I2C_CLIENT_PEC) {
> + addr = i2c_8bit_addr_from_msg(&msgs[0]);
> + crc = crc8(pmbus_crc_table, &addr, 1, crc);
> + crc = crc8(pmbus_crc_table, msgs[0].buf, msgs[0].len, crc);
> +
> + addr = i2c_8bit_addr_from_msg(&msgs[1]);
> + crc = crc8(pmbus_crc_table, &addr, 1, crc);
> + crc = crc8(pmbus_crc_table, msgs[1].buf, msgs[1].buf[0] + 1,
> + crc);
> +
> + if (crc != msgs[1].buf[msgs[1].buf[0] + 1]) {
> + ret = -EBADMSG;
> + goto cleanup;
> + }
> + }
> +
> + memcpy(data_r, &msgs[1].buf[1], msgs[1].buf[0]);
The length of the read buffer is 255 bytes, yet the code suggests
that up to 256 bytes can actually be received.
> + ret = msgs[1].buf[0];
> +
> +cleanup:
> + i2c_put_dma_safe_msg_buf(msgs[0].buf, &msgs[0], true);
> + i2c_put_dma_safe_msg_buf(msgs[1].buf, &msgs[1], true);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(pmbus_block_wr);
> +
> int pmbus_write_byte(struct i2c_client *client, int page, u8 value)
> {
> int rv;
> @@ -2522,6 +2608,8 @@ int pmbus_do_probe(struct i2c_client *client, const struct i2c_device_id *id,
> if (!data->groups)
> return -ENOMEM;
>
> + crc8_populate_msb(pmbus_crc_table, 0x7);
> +
> i2c_set_clientdata(client, data);
> mutex_init(&data->update_lock);
> data->dev = dev;
>
^ permalink raw reply
* Re: [PATCH v2 00/14] PCI: brcmstb: enable PCIe for STB chips
From: Jim Quinlan @ 2020-05-29 17:55 UTC (permalink / raw)
To: Rob Herring
Cc: Ulf Hansson, Heikki Krogerus,
open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
Julien Grall, Christoph Hellwig, Stefano Stabellini,
Saravana Kannan, Rafael J. Wysocki,
maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE, Alan Stern,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE, Corey Minyard,
Suzuki K Poulose, Mark Brown,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
Dan Williams, Andy Shevchenko, moderated list:ARM PORT,
Greg Kroah-Hartman, Oliver Neukum, open list, Wolfram Sang,
open list:DMA MAPPING HELPERS, open list:USB SUBSYSTEM,
Robin Murphy, Nicolas Saenz Julienne
In-Reply-To: <20200529174858.GA2640397@bogus>
On Fri, May 29, 2020 at 1:49 PM Rob Herring <robh@kernel.org> wrote:
>
> On Tue, May 26, 2020 at 03:12:39PM -0400, Jim Quinlan wrote:
> > v2:
> > Commit: "device core: Add ability to handle multiple dma offsets"
> > o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
> > o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
> > o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
> > o dev->dma_pfn_map => dev->dma_pfn_offset_map
> > o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
> > o In device.h: s/const void */const struct dma_pfn_offset_region */
> > o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
> > guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
> > o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
> > dev->dma_pfn_offset_map is copied as well.
> > o Merged two of the DMA commits into one (Christoph).
> >
> > Commit "arm: dma-mapping: Invoke dma offset func if needed":
> > o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> >
> > Other commits' changes:
> > o Removed need for carrying of_id var in priv (Nicolas)
> > o Commit message rewordings (Bjorn)
> > o Commit log messages filled to 75 chars (Bjorn)
> > o devm_reset_control_get_shared())
> > => devm_reset_control_get_optional_shared (Philipp)
> > o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> >
> > v1:
> > This patchset expands the usefulness of the Broadcom Settop Box PCIe
> > controller by building upon the PCIe driver used currently by the
> > Raspbery Pi. Other forms of this patchset were submitted by me years
> > ago and not accepted; the major sticking point was the code required
> > for the DMA remapping needed for the PCIe driver to work [1].
> >
> > There have been many changes to the DMA and OF subsystems since that
> > time, making a cleaner and less intrusive patchset possible. This
> > patchset implements a generalization of "dev->dma_pfn_offset", except
> > that instead of a single scalar offset it provides for multiple
> > offsets via a function which depends upon the "dma-ranges" property of
> > the PCIe host controller. This is required for proper functionality
> > of the BrcmSTB PCIe controller and possibly some other devices.
>
> If you can enable the h/w support without the multiple offset support,
> then I'd split up this series. The latter part might take a bit more
> time.
>
> Rob
Unfortunately, the STB PCIe controller depends on the multiple PFN
offset functionality.
Thanks,
Jim
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 00/14] PCI: brcmstb: enable PCIe for STB chips
From: Jim Quinlan via iommu @ 2020-05-29 17:55 UTC (permalink / raw)
To: Rob Herring
Cc: Ulf Hansson, Heikki Krogerus,
open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
Julien Grall, Christoph Hellwig, Stefano Stabellini,
Saravana Kannan, Rafael J. Wysocki,
maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE, Alan Stern,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE, Corey Minyard,
Suzuki K Poulose, Mark Brown,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
Dan Williams, Andy Shevchenko, moderated list:ARM PORT,
Greg Kroah-Hartman, Oliver Neukum, open list, Wolfram Sang,
open list:DMA MAPPING HELPERS, open list:USB SUBSYSTEM,
Robin Murphy, Nicolas Saenz Julienne
In-Reply-To: <20200529174858.GA2640397@bogus>
On Fri, May 29, 2020 at 1:49 PM Rob Herring <robh@kernel.org> wrote:
>
> On Tue, May 26, 2020 at 03:12:39PM -0400, Jim Quinlan wrote:
> > v2:
> > Commit: "device core: Add ability to handle multiple dma offsets"
> > o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
> > o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
> > o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
> > o dev->dma_pfn_map => dev->dma_pfn_offset_map
> > o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
> > o In device.h: s/const void */const struct dma_pfn_offset_region */
> > o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
> > guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
> > o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
> > dev->dma_pfn_offset_map is copied as well.
> > o Merged two of the DMA commits into one (Christoph).
> >
> > Commit "arm: dma-mapping: Invoke dma offset func if needed":
> > o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> >
> > Other commits' changes:
> > o Removed need for carrying of_id var in priv (Nicolas)
> > o Commit message rewordings (Bjorn)
> > o Commit log messages filled to 75 chars (Bjorn)
> > o devm_reset_control_get_shared())
> > => devm_reset_control_get_optional_shared (Philipp)
> > o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> >
> > v1:
> > This patchset expands the usefulness of the Broadcom Settop Box PCIe
> > controller by building upon the PCIe driver used currently by the
> > Raspbery Pi. Other forms of this patchset were submitted by me years
> > ago and not accepted; the major sticking point was the code required
> > for the DMA remapping needed for the PCIe driver to work [1].
> >
> > There have been many changes to the DMA and OF subsystems since that
> > time, making a cleaner and less intrusive patchset possible. This
> > patchset implements a generalization of "dev->dma_pfn_offset", except
> > that instead of a single scalar offset it provides for multiple
> > offsets via a function which depends upon the "dma-ranges" property of
> > the PCIe host controller. This is required for proper functionality
> > of the BrcmSTB PCIe controller and possibly some other devices.
>
> If you can enable the h/w support without the multiple offset support,
> then I'd split up this series. The latter part might take a bit more
> time.
>
> Rob
Unfortunately, the STB PCIe controller depends on the multiple PFN
offset functionality.
Thanks,
Jim
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply
* Re: [PATCH v2 00/14] PCI: brcmstb: enable PCIe for STB chips
From: Jim Quinlan @ 2020-05-29 17:55 UTC (permalink / raw)
To: Rob Herring
Cc: open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS,
Christoph Hellwig, Nicolas Saenz Julienne,
maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE, Alan Stern,
Andy Shevchenko, Corey Minyard, Dan Williams,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE,
Greg Kroah-Hartman, Heikki Krogerus,
open list:DMA MAPPING HELPERS, Julien Grall,
moderated list:ARM PORT,
open list:LIBATA SUBSYSTEM (Serial and Parallel ATA drivers),
open list,
moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE,
open list:USB SUBSYSTEM, Mark Brown, Oliver Neukum,
Rafael J. Wysocki, Robin Murphy, Saravana Kannan,
Stefano Stabellini, Suzuki K Poulose, Ulf Hansson, Wolfram Sang
In-Reply-To: <20200529174858.GA2640397@bogus>
On Fri, May 29, 2020 at 1:49 PM Rob Herring <robh@kernel.org> wrote:
>
> On Tue, May 26, 2020 at 03:12:39PM -0400, Jim Quinlan wrote:
> > v2:
> > Commit: "device core: Add ability to handle multiple dma offsets"
> > o Added helper func attach_dma_pfn_offset_map() in address.c (Chistoph)
> > o Helpers funcs added to __phys_to_dma() & __dma_to_phys() (Christoph)
> > o Added warning when multiple offsets are needed and !DMA_PFN_OFFSET_MAP
> > o dev->dma_pfn_map => dev->dma_pfn_offset_map
> > o s/frm/from/ for dma_pfn_offset_frm_{phys,dma}_addr() (Christoph)
> > o In device.h: s/const void */const struct dma_pfn_offset_region */
> > o removed 'unlikely' from unlikely(dev->dma_pfn_offset_map) since
> > guarded by CONFIG_DMA_PFN_OFFSET_MAP (Christoph)
> > o Since dev->dma_pfn_offset is copied in usb/core/{usb,message}.c, now
> > dev->dma_pfn_offset_map is copied as well.
> > o Merged two of the DMA commits into one (Christoph).
> >
> > Commit "arm: dma-mapping: Invoke dma offset func if needed":
> > o Use helper functions instead of #if CONFIG_DMA_PFN_OFFSET
> >
> > Other commits' changes:
> > o Removed need for carrying of_id var in priv (Nicolas)
> > o Commit message rewordings (Bjorn)
> > o Commit log messages filled to 75 chars (Bjorn)
> > o devm_reset_control_get_shared())
> > => devm_reset_control_get_optional_shared (Philipp)
> > o Add call to reset_control_assert() in PCIe remove routines (Philipp)
> >
> > v1:
> > This patchset expands the usefulness of the Broadcom Settop Box PCIe
> > controller by building upon the PCIe driver used currently by the
> > Raspbery Pi. Other forms of this patchset were submitted by me years
> > ago and not accepted; the major sticking point was the code required
> > for the DMA remapping needed for the PCIe driver to work [1].
> >
> > There have been many changes to the DMA and OF subsystems since that
> > time, making a cleaner and less intrusive patchset possible. This
> > patchset implements a generalization of "dev->dma_pfn_offset", except
> > that instead of a single scalar offset it provides for multiple
> > offsets via a function which depends upon the "dma-ranges" property of
> > the PCIe host controller. This is required for proper functionality
> > of the BrcmSTB PCIe controller and possibly some other devices.
>
> If you can enable the h/w support without the multiple offset support,
> then I'd split up this series. The latter part might take a bit more
> time.
>
> Rob
Unfortunately, the STB PCIe controller depends on the multiple PFN
offset functionality.
Thanks,
Jim
^ permalink raw reply
* Re: [PATCH v3 2/4] dt-bindings: clk: Add Baikal-T1 CCU Dividers binding
From: Rob Herring @ 2020-05-29 17:55 UTC (permalink / raw)
To: Serge Semin
Cc: linux-clk, linux-kernel, devicetree, Thomas Bogendoerfer,
Alexey Malahov, Philipp Zabel, Stephen Boyd, Arnd Bergmann,
linux-mips, Michael Turquette, Rob Herring, Serge Semin
In-Reply-To: <20200526222056.18072-3-Sergey.Semin@baikalelectronics.ru>
On Wed, 27 May 2020 01:20:54 +0300, Serge Semin wrote:
> After being gained by the CCU PLLs the signals must be transformed to
> be suitable for the clock-consumers. This is done by a set of dividers
> embedded into the CCU. A first block of dividers is used to create
> reference clocks for AXI-bus of high-speed peripheral IP-cores of the
> chip. The second block dividers alter the PLLs output signals to be then
> consumed by SoC peripheral devices. Both block DT nodes are ordinary
> clock-providers with standard set of properties supported. But in addition
> to that each clock provider can be used to reset the corresponding clock
> domain. This makes the AXI-bus and System Devices CCU DT nodes to be also
> reset-providers.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-mips@vger.kernel.org
>
> ---
>
> Changelog v2:
> - Rearrange the SoBs.
> - Combine AXI-bus and System Devices CCU bindings into a single file.
> - Discard comments in the bindings file header.
> - Add dual GPL/BSD license.
> - Add spaces around the ASCII-graphics in the binding description.
> - Remove reference to Documentation/devicetree/bindings/clock/clock-bindings.txt
> file.
> - Discard redundant object check against "/schemas/clock/clock.yaml#" schema.
> - Discard redundant descriptions of "#clock-cells" and "#reset-cells"
> properties.
> - Discard "reg" property since the CCU dividers DT nodes are supposed be
> children of the syscon-compatible system controller node.
> - Remove "clock-output-names" property support.
> - Replace "additionalProperties: false" with "unevaluatedProperties: false".
> - Lowercase the nodes name in the examples.
> - Use "clock-controller" node name suffix in the examples.
> - Remove unnecessary comments in the clocks and resets dt-binding header
> files.
> - Discard label definitions in the examples.
>
> Changelog v3:
> - Get the reg property back even though the driver is using the parental
> syscon regmap.
> - The DT schema will live separately from the system controller, but the
> corresponding sub-node of the later DT schema will $ref this one.
> ---
> .../bindings/clock/baikal,bt1-ccu-div.yaml | 188 ++++++++++++++++++
> include/dt-bindings/clock/bt1-ccu.h | 32 +++
> include/dt-bindings/reset/bt1-ccu.h | 25 +++
> 3 files changed, 245 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/clock/baikal,bt1-ccu-div.yaml
> create mode 100644 include/dt-bindings/reset/bt1-ccu.h
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: linux-next: Tree for May 14 (objtool 2/2)
From: Josh Poimboeuf @ 2020-05-29 17:54 UTC (permalink / raw)
To: Kees Cook
Cc: Randy Dunlap, Stephen Rothwell, Linux Next Mailing List,
Linux Kernel Mailing List, Peter Zijlstra
In-Reply-To: <202005282258.94570AF@keescook>
On Thu, May 28, 2020 at 11:06:32PM -0700, Kees Cook wrote:
> On Thu, May 28, 2020 at 10:44:04AM -0500, Josh Poimboeuf wrote:
> > On Thu, May 14, 2020 at 09:04:36AM -0700, Randy Dunlap wrote:
> > > On 5/14/20 4:07 AM, Stephen Rothwell wrote:
> > > > Hi all,
> > > >
> > > > Changes since 20200512:
> > > >
> > >
> > > on x86_64:
> > >
> > > drivers/ide/ide-tape.o: warning: objtool: ide_tape_discard_merge_buffer.constprop.7()+0x4e: unreachable instruction
> > > drivers/scsi/sd.o: warning: objtool: sd_pr_clear()+0x1e: unreachable instruction
> > > drivers/scsi/sd_zbc.o: warning: objtool: sd_zbc_update_wp_offset_workfn()+0xec: unreachable instruction
> > > drivers/target/target_core_xcopy.o: warning: objtool: target_xcopy_do_work()+0xdd6: unreachable instruction
> > >
> > >
> > > randconfig file is attached.
> >
> > Kees,
> >
> > More UBSAN_TRAP fun. This randconfig has:
> >
> > CONFIG_UBSAN_TRAP=y
> > CONFIG_UBSAN_ALIGNMENT=y
> > # CONFIG_COMPILE_TEST is not set
>
> Ugh, I thought CONFIG_COMPILE_TEST always gets set for randconfig and
> the all*config choices, but now I see that CONFIG_COMPILE_TEST is
> enabled due to the "all" part of the all*config choices. Okay. Big
> hammer:
Yeah, I didn't realize that either... /me wonders if that should change.
> diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
> index 929211039bac..27bcc2568c95 100644
> --- a/lib/Kconfig.ubsan
> +++ b/lib/Kconfig.ubsan
> @@ -63,7 +63,7 @@ config UBSAN_SANITIZE_ALL
> config UBSAN_ALIGNMENT
> bool "Enable checks for pointers alignment"
> default !HAVE_EFFICIENT_UNALIGNED_ACCESS
> - depends on !X86 || !COMPILE_TEST
> + depends on !UBSAN_TRAP
> help
> This option enables the check of unaligned memory accesses.
> Enabling this option on architectures that support unaligned
>
> How about that?
But I thought you said the alignment traps might be useful on other
arches? Should it be
depends on !X86 || !UBSAN_TRAP
?
--
Josh
^ permalink raw reply
* Re: [PATCH] net: atm: Replace kmalloc with kzalloc in the error message
From: Markus Elfring @ 2020-05-29 17:54 UTC (permalink / raw)
To: Andy Shevchenko, Liao Pingfang, netdev
Cc: linux-kernel, kernel-janitors, Cong Wang, David S. Miller,
Heiner Kallweit, Jakub Kicinski, Michael S. Tsirkin,
Shannon Nelson, Wang Liang, Yi Wang, Xue Zhihong
> Looking into the context (atomic!) and error message itself I would rather drop
> message completely.
How do you think about to take another look at a previous update suggestion
like the following?
net/atm: Delete an error message for a failed memory allocation in five functions
https://patchwork.ozlabs.org/project/netdev/patch/5270f15b-5e97-0c3e-3e55-fbded48ae07d@users.sourceforge.net/
https://lore.kernel.org/lkml/5270f15b-5e97-0c3e-3e55-fbded48ae07d@users.sourceforge.net/
https://lore.kernel.org/patchwork/patch/838867/
https://lkml.org/lkml/2017/10/9/1009
Regards,
Markus
^ permalink raw reply
* [RFC PATCH linux-next] Revert "net: bcmgenet: bcmgenet_hfb_add_filter() can be static
From: kbuild test robot @ 2020-05-29 17:54 UTC (permalink / raw)
To: Doug, Berger,
Cc: kbuild-all, Florian Fainelli, bcm-kernel-feedback-list, netdev,
linux-kernel
In-Reply-To: <202005300154.63FdkmJb%lkp@intel.com>
Fixes: 14da1510fedc ("Revert "net: bcmgenet: remove unused function in bcmgenet.c"")
Signed-off-by: kbuild test robot <lkp@intel.com>
---
bcmgenet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index b37ef05c5083a..98e492e066dcb 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2855,8 +2855,8 @@ static int bcmgenet_hfb_find_unused_filter(struct bcmgenet_priv *priv)
* bcmgenet_hfb_add_filter(priv, hfb_filter_ipv4_udp,
* ARRAY_SIZE(hfb_filter_ipv4_udp), 0);
*/
-int bcmgenet_hfb_add_filter(struct bcmgenet_priv *priv, u32 *f_data,
- u32 f_length, u32 rx_queue)
+static int bcmgenet_hfb_add_filter(struct bcmgenet_priv *priv, u32 *f_data,
+ u32 f_length, u32 rx_queue)
{
int f_index;
u32 i;
^ permalink raw reply related
* Re: [PATCH] ALSA: Fixing usage of plain int instead of NULL
From: Takashi Iwai @ 2020-05-29 17:53 UTC (permalink / raw)
To: Thomas Ebeling; +Cc: alsa-devel, Takashi Iwai
In-Reply-To: <20200529173248.zzawijfvw73kzjxt@bollie.ca9.eu>
On Fri, 29 May 2020 19:32:56 +0200,
Thomas Ebeling wrote:
>
> As reported by kbuild test robot, mixer quirks for RME Babyface
> Pro used plain integer instead of NULL.
>
> Signed-off-by: Thomas Ebeling <penguins@bollie.de>
> Reported-by: kbuild test robot <lkp@intel.com>
Applied, thanks.
Takashi
^ permalink raw reply
* Re: [PATCH v3 1/4] dt-bindings: clk: Add Baikal-T1 CCU PLLs binding
From: Rob Herring @ 2020-05-29 17:54 UTC (permalink / raw)
To: Serge Semin
Cc: Arnd Bergmann, linux-clk, linux-kernel, linux-mips,
Thomas Bogendoerfer, Serge Semin, Rob Herring, Michael Turquette,
devicetree, Alexey Malahov, Stephen Boyd
In-Reply-To: <20200526222056.18072-2-Sergey.Semin@baikalelectronics.ru>
On Wed, 27 May 2020 01:20:53 +0300, Serge Semin wrote:
> Baikal-T1 Clocks Control Unit is responsible for transformation of a
> signal coming from an external oscillator into clocks of various
> frequencies to propagate them then to the corresponding clocks
> consumers (either individual IP-blocks or clock domains). In order
> to create a set of high-frequency clocks the external signal is
> firstly handled by the embedded into CCU PLLs. So the corresponding
> dts-node is just a normal clock-provider node with standard set of
> properties. Note as being part of the Baikal-T1 System Controller its
> DT node is supposed to be a child the system controller node.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Cc: Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: linux-mips@vger.kernel.org
>
> ---
>
> Changelog v2:
> - Rearrange the SoBs.
> - Discard comments in the bindings file header.
> - Add dual GPL/BSD license.
> - Add spaces around the ASCII-graphics in the binding description.
> - Remove reference to Documentation/devicetree/bindings/clock/clock-bindings.txt
> file.
> - Discard redundant object check against "/schemas/clock/clock.yaml#" schema.
> - Discard redundant descriptions of the "#clock-cells" property.
> - Remove "reg" property since from now the clock DT node is supposed to be
> a child of the syscon-compatible system controller node.
> - Remove "clock-output-names" property support.
> - Replace "additionalProperties: false" with "unevaluatedProperties: false".
> - Lowercase the nodes name in the examples.
> - Use "clock-controller" node name suffix in the examples.
> - Remove unnecessary comments in the clocks dt-bindings header file.
>
> Changelog v3:
> - Get the reg property back even though the driver is using the parental
> syscon regmap.
> - The DT schema will live separately from the system controller, but the
> corresponding sub-node of the later DT schema will $ref this one.
> ---
> .../bindings/clock/baikal,bt1-ccu-pll.yaml | 131 ++++++++++++++++++
> include/dt-bindings/clock/bt1-ccu.h | 16 +++
> 2 files changed, 147 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/clock/baikal,bt1-ccu-pll.yaml
> create mode 100644 include/dt-bindings/clock/bt1-ccu.h
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply
* Re: [PATCH] net: atm: Replace kmalloc with kzalloc in the error message
From: Markus Elfring @ 2020-05-29 17:54 UTC (permalink / raw)
To: Andy Shevchenko, Liao Pingfang, netdev
Cc: linux-kernel, kernel-janitors, Cong Wang, David S. Miller,
Heiner Kallweit, Jakub Kicinski, Michael S. Tsirkin,
Shannon Nelson, Wang Liang, Yi Wang, Xue Zhihong
> Looking into the context (atomic!) and error message itself I would rather drop
> message completely.
How do you think about to take another look at a previous update suggestion
like the following?
net/atm: Delete an error message for a failed memory allocation in five functions
https://patchwork.ozlabs.org/project/netdev/patch/5270f15b-5e97-0c3e-3e55-fbded48ae07d@users.sourceforge.net/
https://lore.kernel.org/lkml/5270f15b-5e97-0c3e-3e55-fbded48ae07d@users.sourceforge.net/
https://lore.kernel.org/patchwork/patch/838867/
https://lkml.org/lkml/2017/10/9/1009
Regards,
Markus
^ permalink raw reply
* [PATCH for_v31 4/6] x86/sgx: Replace "grab" with "alloc" in VA page helper
From: Sean Christopherson @ 2020-05-29 17:54 UTC (permalink / raw)
To: Jarkko Sakkinen; +Cc: linux-sgx
In-Reply-To: <20200529175407.2109-1-sean.j.christopherson@intel.com>
Rename sgx_grab_va_page() to sgx_alloc_va_page() to align with
sgx_alloc_epc_page() as well as sgx_free_epc_page(); the latter is used
directly when freeing the VA page, i.e. the names should be consistent.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
arch/x86/kernel/cpu/sgx/encl.c | 6 +++---
arch/x86/kernel/cpu/sgx/encl.h | 2 +-
arch/x86/kernel/cpu/sgx/ioctl.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
index e9d72f05a1f12..df4ae76dd83f6 100644
--- a/arch/x86/kernel/cpu/sgx/encl.c
+++ b/arch/x86/kernel/cpu/sgx/encl.c
@@ -686,15 +686,15 @@ struct sgx_encl_page *sgx_encl_reserve_page(struct sgx_encl *encl,
}
/**
- * sgx_grab_va_page() - Grab a Version Array (VA) page
+ * sgx_alloc_va_page() - Allocate a Version Array (VA) page
*
- * Grab a free EPC page instance and convert it to a Version Array (VA) page.
+ * Allocate a free EPC page and convert it to a Version Array (VA) page.
*
* Return:
* a VA page,
* -errno otherwise
*/
-struct sgx_epc_page *sgx_grab_va_page(void)
+struct sgx_epc_page *sgx_alloc_va_page(void)
{
struct sgx_epc_page *epc_page;
int ret;
diff --git a/arch/x86/kernel/cpu/sgx/encl.h b/arch/x86/kernel/cpu/sgx/encl.h
index 625ad44a83215..f0f72e5912445 100644
--- a/arch/x86/kernel/cpu/sgx/encl.h
+++ b/arch/x86/kernel/cpu/sgx/encl.h
@@ -120,7 +120,7 @@ int sgx_encl_test_and_clear_young(struct mm_struct *mm,
struct sgx_encl_page *sgx_encl_reserve_page(struct sgx_encl *encl,
unsigned long addr);
-struct sgx_epc_page *sgx_grab_va_page(void);
+struct sgx_epc_page *sgx_alloc_va_page(void);
unsigned int sgx_alloc_va_slot(struct sgx_va_page *va_page);
void sgx_free_va_slot(struct sgx_va_page *va_page, unsigned int offset);
bool sgx_va_page_full(struct sgx_va_page *va_page);
diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c
index f7232a5343262..4f70cb8144ffd 100644
--- a/arch/x86/kernel/cpu/sgx/ioctl.c
+++ b/arch/x86/kernel/cpu/sgx/ioctl.c
@@ -32,7 +32,7 @@ static struct sgx_va_page *sgx_encl_grow(struct sgx_encl *encl)
if (!va_page)
return ERR_PTR(-ENOMEM);
- va_page->epc_page = sgx_grab_va_page();
+ va_page->epc_page = sgx_alloc_va_page();
if (IS_ERR(va_page->epc_page)) {
err = ERR_CAST(va_page->epc_page);
kfree(va_page);
--
2.26.0
^ permalink raw reply related
* [PATCH for_v31 3/6] x86/sgx: Rename sgx_free_page() to sgx_free_epc_page()
From: Sean Christopherson @ 2020-05-29 17:54 UTC (permalink / raw)
To: Jarkko Sakkinen; +Cc: linux-sgx
In-Reply-To: <20200529175407.2109-1-sean.j.christopherson@intel.com>
Add "epc" into the free page helper to match sgx_alloc_epc_page().
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
arch/x86/kernel/cpu/sgx/encl.c | 10 +++++-----
arch/x86/kernel/cpu/sgx/ioctl.c | 6 +++---
arch/x86/kernel/cpu/sgx/main.c | 12 ++++++------
arch/x86/kernel/cpu/sgx/sgx.h | 2 +-
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c
index c52c937b8d67b..e9d72f05a1f12 100644
--- a/arch/x86/kernel/cpu/sgx/encl.c
+++ b/arch/x86/kernel/cpu/sgx/encl.c
@@ -73,7 +73,7 @@ static struct sgx_epc_page *sgx_encl_eldu(struct sgx_encl_page *encl_page,
ret = __sgx_encl_eldu(encl_page, epc_page, secs_page);
if (ret) {
- sgx_free_page(epc_page);
+ sgx_free_epc_page(epc_page);
return ERR_PTR(ret);
}
@@ -482,7 +482,7 @@ void sgx_encl_destroy(struct sgx_encl *encl)
if (sgx_unmark_page_reclaimable(entry->epc_page))
continue;
- sgx_free_page(entry->epc_page);
+ sgx_free_epc_page(entry->epc_page);
encl->secs_child_cnt--;
entry->epc_page = NULL;
}
@@ -493,7 +493,7 @@ void sgx_encl_destroy(struct sgx_encl *encl)
}
if (!encl->secs_child_cnt && encl->secs.epc_page) {
- sgx_free_page(encl->secs.epc_page);
+ sgx_free_epc_page(encl->secs.epc_page);
encl->secs.epc_page = NULL;
}
@@ -506,7 +506,7 @@ void sgx_encl_destroy(struct sgx_encl *encl)
va_page = list_first_entry(&encl->va_pages, struct sgx_va_page,
list);
list_del(&va_page->list);
- sgx_free_page(va_page->epc_page);
+ sgx_free_epc_page(va_page->epc_page);
kfree(va_page);
}
}
@@ -706,7 +706,7 @@ struct sgx_epc_page *sgx_grab_va_page(void)
ret = __epa(sgx_get_epc_addr(epc_page));
if (ret) {
WARN_ONCE(1, "EPA returned %d (0x%x)", ret, ret);
- sgx_free_page(epc_page);
+ sgx_free_epc_page(epc_page);
return ERR_PTR(-EFAULT);
}
diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c b/arch/x86/kernel/cpu/sgx/ioctl.c
index 2019ee1dc0b3e..f7232a5343262 100644
--- a/arch/x86/kernel/cpu/sgx/ioctl.c
+++ b/arch/x86/kernel/cpu/sgx/ioctl.c
@@ -50,7 +50,7 @@ static void sgx_encl_shrink(struct sgx_encl *encl, struct sgx_va_page *va_page)
encl->page_cnt--;
if (va_page) {
- sgx_free_page(va_page->epc_page);
+ sgx_free_epc_page(va_page->epc_page);
list_del(&va_page->list);
kfree(va_page);
}
@@ -223,7 +223,7 @@ static int sgx_encl_create(struct sgx_encl *encl, struct sgx_secs *secs)
return 0;
err_out:
- sgx_free_page(encl->secs.epc_page);
+ sgx_free_epc_page(encl->secs.epc_page);
encl->secs.epc_page = NULL;
err_out_backing:
@@ -449,7 +449,7 @@ static int sgx_encl_add_page(struct sgx_encl *encl, unsigned long src,
up_read(¤t->mm->mmap_sem);
err_out_free:
- sgx_free_page(epc_page);
+ sgx_free_epc_page(epc_page);
kfree(encl_page);
/*
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c
index ef7061bfa2a07..855b14237e7c4 100644
--- a/arch/x86/kernel/cpu/sgx/main.c
+++ b/arch/x86/kernel/cpu/sgx/main.c
@@ -376,7 +376,7 @@ static void sgx_reclaimer_write(struct sgx_epc_page *epc_page,
if (!encl->secs_child_cnt) {
if (atomic_read(&encl->flags) & SGX_ENCL_DEAD) {
- sgx_free_page(encl->secs.epc_page);
+ sgx_free_epc_page(encl->secs.epc_page);
encl->secs.epc_page = NULL;
} else if (atomic_read(&encl->flags) & SGX_ENCL_INITIALIZED) {
ret = sgx_encl_get_backing(encl, PFN_DOWN(encl->size),
@@ -386,7 +386,7 @@ static void sgx_reclaimer_write(struct sgx_epc_page *epc_page,
sgx_encl_ewb(encl->secs.epc_page, &secs_backing);
- sgx_free_page(encl->secs.epc_page);
+ sgx_free_epc_page(encl->secs.epc_page);
encl->secs.epc_page = NULL;
sgx_encl_put_backing(&secs_backing, true);
@@ -508,7 +508,7 @@ static struct sgx_epc_page *__sgx_alloc_epc_page_from_section(struct sgx_epc_sec
* __sgx_alloc_epc_page() - Grab a free EPC page
*
* Iterate through EPC sections and borrow a free EPC page to the caller. When a
- * page is no longer needed it must be released with sgx_free_page().
+ * page is no longer needed it must be released with sgx_free_epc_page().
*
* Return:
* an EPC page,
@@ -539,7 +539,7 @@ struct sgx_epc_page *__sgx_alloc_epc_page(void)
* @reclaim: reclaim pages if necessary
*
* Iterate through EPC sections and borrow a free EPC page to the caller. When a
- * page is no longer needed it must be released with sgx_free_page(). If
+ * page is no longer needed it must be released with sgx_free_epc_page(). If
* @reclaim is set to true, directly reclaim pages when we are out of pages. No
* mm's can be locked when @reclaim is set to true.
*
@@ -585,12 +585,12 @@ struct sgx_epc_page *sgx_alloc_epc_page(void *owner, bool reclaim)
}
/**
- * sgx_free_page() - Free an EPC page
+ * sgx_free_epc_page() - Free an EPC page
* @page: an EPC page
*
* Call EREMOVE for an EPC page and insert it back to the list of free pages.
*/
-void sgx_free_page(struct sgx_epc_page *page)
+void sgx_free_epc_page(struct sgx_epc_page *page)
{
struct sgx_epc_section *section = sgx_get_epc_section(page);
int ret;
diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h
index 5b9dbcef981b0..2983c1a3d725d 100644
--- a/arch/x86/kernel/cpu/sgx/sgx.h
+++ b/arch/x86/kernel/cpu/sgx/sgx.h
@@ -62,6 +62,6 @@ static inline void *sgx_get_epc_addr(struct sgx_epc_page *page)
struct sgx_epc_page *__sgx_alloc_epc_page(void);
struct sgx_epc_page *sgx_alloc_epc_page(void *owner, bool reclaim);
-void sgx_free_page(struct sgx_epc_page *page);
+void sgx_free_epc_page(struct sgx_epc_page *page);
#endif /* _X86_SGX_H */
--
2.26.0
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.