[PATCH v7 15/39] drm/i915: hdcp_check_link only on CP_IRQ

2018-09-27 Thread Ramalingam C
HDCP check link is invoked only on CP_IRQ detection, instead of all
short pulses.

v3:
  No Changes.
v4:
  Added sean in cc and collected the reviewed-by received.
v5:
  No Change.
v6:
  No Change.
v7:
  No Change.

Signed-off-by: Ramalingam C 
cc: Sean Paul 
Reviewed-by: Uma Shankar 
Reviewed-by: Sean Paul 
---
 drivers/gpu/drm/i915/intel_dp.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 893f8404e64c..bd83ee585cd3 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4483,8 +4483,10 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
 
if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST)
intel_dp_handle_test_request(intel_dp);
-   if (sink_irq_vector & (DP_CP_IRQ | DP_SINK_SPECIFIC_IRQ))
-   DRM_DEBUG_DRIVER("CP or sink specific irq unhandled\n");
+   if (sink_irq_vector & DP_CP_IRQ)
+   intel_hdcp_check_link(intel_dp->attached_connector);
+   if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ)
+   DRM_DEBUG_DRIVER("Sink specific irq unhandled\n");
}
 
/* Handle CEC interrupts, if any */
@@ -5676,9 +5678,6 @@ intel_dp_hpd_pulse(struct intel_digital_port 
*intel_dig_port, bool long_hpd)
 
handled = intel_dp_short_pulse(intel_dp);
 
-   /* Short pulse can signify loss of hdcp authentication */
-   intel_hdcp_check_link(intel_dp->attached_connector);
-
if (!handled) {
intel_dp->detect_done = false;
goto put_power;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 12/39] drm/i915: Implement HDCP2.2 repeater authentication

2018-09-27 Thread Ramalingam C
Implements the HDCP2.2 repeaters authentication steps such as verifying
the downstream topology and sending stream management information.

v2:
  Rebased.
v3:
  No Changes.
v4:
  -EINVAL is returned for topology error and rollover scenario.
  Endianness conversion func from drm_hdcp.h is used [Uma]
v5:
  Rebased as part of patches reordering.
  Defined the mei service functions [Daniel]
v6:
  Redefined the mei service functions as per comp redesign.
v7:
  %s/uintxx_t/uxx
  Check for comp_master is removed.

Signed-off-by: Ramalingam C 
---
 drivers/gpu/drm/i915/intel_hdcp.c | 165 ++
 include/drm/drm_hdcp.h|  15 
 2 files changed, 180 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c 
b/drivers/gpu/drm/i915/intel_hdcp.c
index 9791b4fd4495..3772db5d4171 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -1002,6 +1002,50 @@ static int hdcp2_prepare_skey(struct intel_connector 
*connector,
return ret;
 }
 
+static int
+hdcp2_verify_rep_topology_prepare_ack(
+   struct intel_connector *connector,
+   struct hdcp2_rep_send_receiverid_list *rep_topology,
+   struct hdcp2_rep_send_ack *rep_send_ack)
+{
+   struct mei_hdcp_data *data = &connector->hdcp.mei_data;
+   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+   struct i915_component_master *comp = dev_priv->comp_master;
+   int ret;
+
+   if (!comp->hdcp_ops || !comp->mei_cldev || data->port == INVALID_PORT)
+   return -EINVAL;
+
+   ret = comp->hdcp_ops->repeater_check_flow_prepare_ack(comp->mei_cldev,
+ data,
+ rep_topology,
+ rep_send_ack);
+   if (ret < 0)
+   comp->hdcp_ops->close_hdcp_session(comp->mei_cldev, data);
+
+   return ret;
+}
+
+static int
+hdcp2_verify_mprime(struct intel_connector *connector,
+   struct hdcp2_rep_stream_ready *stream_ready)
+{
+   struct mei_hdcp_data *data = &connector->hdcp.mei_data;
+   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+   struct i915_component_master *comp = dev_priv->comp_master;
+   int ret;
+
+   if (!comp->hdcp_ops || !comp->mei_cldev || data->port == INVALID_PORT)
+   return -EINVAL;
+
+   ret = comp->hdcp_ops->verify_mprime(comp->mei_cldev, data,
+   stream_ready);
+   if (ret < 0)
+   comp->hdcp_ops->close_hdcp_session(comp->mei_cldev, data);
+
+   return ret;
+}
+
 static int hdcp2_authenticate_port(struct intel_connector *connector)
 {
struct mei_hdcp_data *data = &connector->hdcp.mei_data;
@@ -1171,6 +1215,121 @@ static int hdcp2_session_key_exchange(struct 
intel_connector *connector)
return 0;
 }
 
+static
+int hdcp2_propagate_stream_management_info(struct intel_connector *connector)
+{
+   struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
+   struct intel_hdcp *hdcp = &connector->hdcp;
+   union {
+   struct hdcp2_rep_stream_manage stream_manage;
+   struct hdcp2_rep_stream_ready stream_ready;
+   } msgs;
+   const struct intel_hdcp_shim *shim = hdcp->shim;
+   int ret;
+
+   /* Prepare RepeaterAuth_Stream_Manage msg */
+   msgs.stream_manage.msg_id = HDCP_2_2_REP_STREAM_MANAGE;
+   reverse_endianness(msgs.stream_manage.seq_num_m, HDCP_2_2_SEQ_NUM_LEN,
+  (u8 *)&hdcp->seq_num_m);
+
+   /* K no of streams is fixed as 1. Stored as big-endian. */
+   msgs.stream_manage.k = __swab16(1);
+
+   /* For HDMI this is forced to be 0x0. For DP SST also this is 0x0. */
+   msgs.stream_manage.streams[0].stream_id = 0;
+   msgs.stream_manage.streams[0].stream_type = hdcp->content_type;
+
+   /* Send it to Repeater */
+   ret = shim->write_2_2_msg(intel_dig_port, &msgs.stream_manage,
+ sizeof(msgs.stream_manage));
+   if (ret < 0)
+   return ret;
+
+   ret = shim->read_2_2_msg(intel_dig_port, HDCP_2_2_REP_STREAM_READY,
+&msgs.stream_ready, sizeof(msgs.stream_ready));
+   if (ret < 0)
+   return ret;
+
+   hdcp->mei_data.seq_num_m = hdcp->seq_num_m;
+   hdcp->mei_data.streams[0].stream_type = hdcp->content_type;
+
+   ret = hdcp2_verify_mprime(connector, &msgs.stream_ready);
+   if (ret < 0)
+   return ret;
+
+   hdcp->seq_num_m++;
+
+   if (hdcp->seq_num_m > HDCP_2_2_SEQ_NUM_MAX) {
+   DRM_DEBUG_KMS("seq_num_m roll over.\n");
+   return -1;
+   }
+
+   return 0;
+}
+
+static
+int hdcp2_authenticate_repeater_topology(struct intel_connector *connector)

[PATCH v7 19/39] drm/i915: Add HDCP2.2 support for DP connectors

2018-09-27 Thread Ramalingam C
On DP connector init, intel_hdcp_init is passed with a flag for hdcp2.2
support based on the platform capability.

v2:
  Rebased.
v3:
  No Changes.
v4:
  Collected the reviewed-by received.
v5:
  No change.
v6:
  No change.
v7:
  No change.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/i915/intel_dp.c  | 2 +-
 drivers/gpu/drm/i915/intel_drv.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 1d0147b70b0b..edd01ddfc728 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -6964,7 +6964,7 @@ intel_dp_init_connector(struct intel_digital_port 
*intel_dig_port,
 
if (is_hdcp_supported(dev_priv, port) && !intel_dp_is_edp(intel_dp)) {
int ret = intel_hdcp_init(intel_connector, &intel_dp_hdcp_shim,
- false);
+ is_hdcp2_supported(dev_priv));
if (ret)
DRM_DEBUG_KMS("HDCP init failed, skipping.\n");
}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 9d924baed74d..f688bfacaa99 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -2012,6 +2012,7 @@ bool is_hdcp_supported(struct drm_i915_private *dev_priv, 
enum port port);
 int intel_hdcp_component_init(struct drm_i915_private *dev_priv);
 bool is_hdcp2_supported(struct drm_i915_private *dev_priv);
 void intel_hdcp_handle_cp_irq(struct intel_connector *connector);
+bool is_hdcp2_supported(struct drm_i915_private *dev_priv);
 
 /* intel_psr.c */
 #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 20/39] drm/i915: Add HDCP2.2 support for HDMI connectors

2018-09-27 Thread Ramalingam C
On HDMI connector init, intel_hdcp_init is passed with a flag for hdcp2.2
support based on the platform capability.

v2:
  Rebased.
v3:
  No Changes.
v4:
  Collected the reviewed-by received.
v5:
  No change.
v6:
  No change.
v7:
  No change.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/i915/intel_hdmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index a6fe0e42d348..0ae59cfbb6fa 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -2572,7 +2572,8 @@ void intel_hdmi_init_connector(struct intel_digital_port 
*intel_dig_port,
 
if (is_hdcp_supported(dev_priv, port)) {
int ret = intel_hdcp_init(intel_connector,
- &intel_hdmi_hdcp_shim, false);
+&intel_hdmi_hdcp_shim,
+is_hdcp2_supported(dev_priv));
if (ret)
DRM_DEBUG_KMS("HDCP init failed, skipping.\n");
}
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 17/39] drm/i915: Implement the HDCP2.2 support for DP

2018-09-27 Thread Ramalingam C
Implements the DP adaptation specific HDCP2.2 functions.

These functions perform the DPCD read and write for communicating the
HDCP2.2 auth message back and forth.

v2:
  wait for cp_irq is merged with this patch. Rebased.
v3:
  wait_queue is used for wait for cp_irq [Chris Wilson]
v4:
  Style fixed.
  %s/PARING/PAIRING
  Few style fixes [Uma]
v5:
  Lookup table for DP HDCP2.2 msg details [Daniel].
  Extra lines are removed.
v6:
  Rebased.
v7:
  Fixed some regression introduced at v5. [Ankit]
  Macro HDCP_2_2_RX_CAPS_VERSION_VAL is reused [Uma]
  Converted a function to inline [Uma]
  %s/uintxx_t/uxx

Signed-off-by: Ramalingam C 
Signed-off-by: Ankit K Nautiyal 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/i915/intel_dp.c   | 338 ++
 drivers/gpu/drm/i915/intel_drv.h  |   7 +
 drivers/gpu/drm/i915/intel_hdcp.c |   6 +
 3 files changed, 351 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 11699688c36a..1d0147b70b0b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -5308,6 +5309,27 @@ void intel_dp_encoder_suspend(struct intel_encoder 
*intel_encoder)
pps_unlock(intel_dp);
 }
 
+static int intel_dp_hdcp_wait_for_cp_irq(struct intel_hdcp *hdcp,
+int timeout)
+{
+   long ret;
+
+   /* Reinit */
+   atomic_set(&hdcp->cp_irq_recved, 0);
+
+#define C (atomic_read(&hdcp->cp_irq_recved) > 0)
+   ret = wait_event_interruptible_timeout(hdcp->cp_irq_queue, C,
+  msecs_to_jiffies(timeout));
+
+   if (ret > 0) {
+   atomic_set(&hdcp->cp_irq_recved, 0);
+   return 0;
+   } else if (!ret) {
+   return -ETIMEDOUT;
+   }
+   return (int)ret;
+}
+
 static
 int intel_dp_hdcp_write_an_aksv(struct intel_digital_port *intel_dig_port,
u8 *an)
@@ -5526,6 +5548,316 @@ int intel_dp_hdcp_capable(struct intel_digital_port 
*intel_dig_port,
return 0;
 }
 
+static struct hdcp2_dp_msg_data {
+   u8 msg_id;
+   u32 offset;
+   bool msg_detectable;
+   u32 timeout;
+   u32 timeout2; /* Added for non_paired situation */
+   } hdcp2_msg_data[] = {
+   {HDCP_2_2_AKE_INIT, DP_HDCP_2_2_AKE_INIT_OFFSET, false, 0, 0},
+   {HDCP_2_2_AKE_SEND_CERT, DP_HDCP_2_2_AKE_SEND_CERT_OFFSET,
+   false, HDCP_2_2_CERT_TIMEOUT_MS, 0},
+   {HDCP_2_2_AKE_NO_STORED_KM, DP_HDCP_2_2_AKE_NO_STORED_KM_OFFSET,
+   false, 0, 0},
+   {HDCP_2_2_AKE_STORED_KM, DP_HDCP_2_2_AKE_STORED_KM_OFFSET,
+   false, 0, 0},
+   {HDCP_2_2_AKE_SEND_HPRIME, DP_HDCP_2_2_AKE_SEND_HPRIME_OFFSET,
+   true, HDCP_2_2_HPRIME_PAIRED_TIMEOUT_MS,
+   HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT_MS},
+   {HDCP_2_2_AKE_SEND_PAIRING_INFO,
+   DP_HDCP_2_2_AKE_SEND_PAIRING_INFO_OFFSET, true,
+   HDCP_2_2_PAIRING_TIMEOUT_MS, 0},
+   {HDCP_2_2_LC_INIT, DP_HDCP_2_2_LC_INIT_OFFSET, false, 0, 0},
+   {HDCP_2_2_LC_SEND_LPRIME, DP_HDCP_2_2_LC_SEND_LPRIME_OFFSET,
+   false, HDCP_2_2_DP_LPRIME_TIMEOUT_MS, 0},
+   {HDCP_2_2_SKE_SEND_EKS, DP_HDCP_2_2_SKE_SEND_EKS_OFFSET, false,
+   0, 0},
+   {HDCP_2_2_REP_SEND_RECVID_LIST,
+   DP_HDCP_2_2_REP_SEND_RECVID_LIST_OFFSET, true,
+   HDCP_2_2_RECVID_LIST_TIMEOUT_MS, 0},
+   {HDCP_2_2_REP_SEND_ACK, DP_HDCP_2_2_REP_SEND_ACK_OFFSET, false,
+   0, 0},
+   {HDCP_2_2_REP_STREAM_MANAGE,
+   DP_HDCP_2_2_REP_STREAM_MANAGE_OFFSET, false,
+   0, 0},
+   {HDCP_2_2_REP_STREAM_READY, DP_HDCP_2_2_REP_STREAM_READY_OFFSET,
+   false, HDCP_2_2_STREAM_READY_TIMEOUT_MS, 0},
+   {HDCP_2_2_ERRATA_DP_STREAM_TYPE,
+   DP_HDCP_2_2_REG_STREAM_TYPE_OFFSET, false,
+   0, 0},
+   };
+
+static inline
+int intel_dp_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port,
+ u8 *rx_status)
+{
+   ssize_t ret;
+
+   ret = drm_dp_dpcd_read(&intel_dig_port->dp.aux,
+  DP_HDCP_2_2_REG_RXSTATUS_OFFSET, rx_status,
+  HDCP_2_2_DP_RXSTATUS_LEN);
+   if (ret != HDCP_2_2_DP_RXSTATUS_LEN) {
+   DRM_ERROR("Read bstatus from DP/AUX failed (%zd)\n", ret);
+   return ret >= 0 ? -EIO : ret;
+   }
+
+   return 0;
+

[PATCH v7 16/39] drm/i915: Check HDCP 1.4 and 2.2 link on CP_IRQ

2018-09-27 Thread Ramalingam C
On DP HDCP1.4 and 2.2, when CP_IRQ is received, start the link
integrity check for the HDCP version that is enabled.

v2:
  Rebased. Function name is changed.
v3:
  No Changes.
v4:
  No Changes.
v5:
  No Changes.
v6:
  %s/_in_force/_in_use [Sean Paul]
v7:
  Rebased.

Signed-off-by: Ramalingam C 
cc: Sean Paul 
Reviewed-by: Sean Paul 
---
 drivers/gpu/drm/i915/intel_dp.c   |  2 +-
 drivers/gpu/drm/i915/intel_drv.h  |  2 +-
 drivers/gpu/drm/i915/intel_hdcp.c | 29 +
 3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index bd83ee585cd3..11699688c36a 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -4484,7 +4484,7 @@ intel_dp_short_pulse(struct intel_dp *intel_dp)
if (sink_irq_vector & DP_AUTOMATED_TEST_REQUEST)
intel_dp_handle_test_request(intel_dp);
if (sink_irq_vector & DP_CP_IRQ)
-   intel_hdcp_check_link(intel_dp->attached_connector);
+   intel_hdcp_handle_cp_irq(intel_dp->attached_connector);
if (sink_irq_vector & DP_SINK_SPECIFIC_IRQ)
DRM_DEBUG_DRIVER("Sink specific irq unhandled\n");
}
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index be12b7928375..af580eb171a5 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -2001,10 +2001,10 @@ int intel_hdcp_init(struct intel_connector *connector,
bool hdcp2_supported);
 int intel_hdcp_enable(struct intel_connector *connector);
 int intel_hdcp_disable(struct intel_connector *connector);
-int intel_hdcp_check_link(struct intel_connector *connector);
 bool is_hdcp_supported(struct drm_i915_private *dev_priv, enum port port);
 int intel_hdcp_component_init(struct drm_i915_private *dev_priv);
 bool is_hdcp2_supported(struct drm_i915_private *dev_priv);
+void intel_hdcp_handle_cp_irq(struct intel_connector *connector);
 
 /* intel_psr.c */
 #define CAN_PSR(dev_priv) (HAS_PSR(dev_priv) && dev_priv->psr.sink_support)
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c 
b/drivers/gpu/drm/i915/intel_hdcp.c
index 89e913732b2d..1f6bc1155405 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -93,6 +93,26 @@ static bool intel_hdcp2_capable(struct intel_connector 
*connector)
return capable;
 }
 
+static inline bool intel_hdcp_in_use(struct intel_connector *connector)
+{
+   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+   enum port port = connector->encoder->port;
+   u32 reg;
+
+   reg = I915_READ(PORT_HDCP_STATUS(port));
+   return reg & (HDCP_STATUS_AUTH | HDCP_STATUS_ENC);
+}
+
+static inline bool intel_hdcp2_in_use(struct intel_connector *connector)
+{
+   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+   enum port port = connector->encoder->port;
+   u32 reg;
+
+   reg = I915_READ(HDCP2_STATUS_DDI(port));
+   return reg & (LINK_ENCRYPTION_STATUS | LINK_AUTH_STATUS);
+}
+
 static int intel_hdcp_poll_ksv_fifo(struct intel_digital_port *intel_dig_port,
const struct intel_hdcp_shim *shim)
 {
@@ -1795,3 +1815,12 @@ void intel_hdcp_atomic_check(struct drm_connector 
*connector,
   new_state->crtc);
crtc_state->mode_changed = true;
 }
+
+/* Handles the CP_IRQ raised from the DP HDCP sink */
+void intel_hdcp_handle_cp_irq(struct intel_connector *connector)
+{
+   if (intel_hdcp_in_use(connector))
+   intel_hdcp_check_link(connector);
+   else if (intel_hdcp2_in_use(connector))
+   intel_hdcp2_check_link(connector);
+}
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 21/39] mei: bus: whitelist hdcp client

2018-09-27 Thread Ramalingam C
From: Tomas Winkler 

Whitelist HDCP client for in kernel drm use

v2:
  Rebased.
v3:
  No changes.
v4:
  No changes.
v5:
  No changes.
v6:
  No changes
v7:
  No changes

Signed-off-by: Tomas Winkler 
---
 drivers/misc/mei/bus-fixup.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/misc/mei/bus-fixup.c b/drivers/misc/mei/bus-fixup.c
index a6f41f96f2a1..c307399f898c 100644
--- a/drivers/misc/mei/bus-fixup.c
+++ b/drivers/misc/mei/bus-fixup.c
@@ -41,6 +41,9 @@ static const uuid_le mei_nfc_info_guid = MEI_UUID_NFC_INFO;
 #define MEI_UUID_MKHIF_FIX UUID_LE(0x55213584, 0x9a29, 0x4916, \
0xba, 0xdf, 0xf, 0xb7, 0xed, 0x68, 0x2a, 0xeb)
 
+#define MEI_UUID_HDCP UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, \
+ 0xA5, 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04)
+
 #define MEI_UUID_ANY NULL_UUID_LE
 
 /**
@@ -72,6 +75,18 @@ static void blacklist(struct mei_cl_device *cldev)
cldev->do_match = 0;
 }
 
+/**
+ * whitelist - forcefully whitelist client
+ *
+ * @cldev: me clients device
+ */
+static void whitelist(struct mei_cl_device *cldev)
+{
+   dev_dbg(&cldev->dev, "running hook %s\n", __func__);
+
+   cldev->do_match = 1;
+}
+
 #define OSTYPE_LINUX2
 struct mei_os_ver {
__le16 build;
@@ -473,6 +488,7 @@ static struct mei_fixup {
MEI_FIXUP(MEI_UUID_NFC_HCI, mei_nfc),
MEI_FIXUP(MEI_UUID_WD, mei_wd),
MEI_FIXUP(MEI_UUID_MKHIF_FIX, mei_mkhi_fix),
+   MEI_FIXUP(MEI_UUID_HDCP, whitelist),
 };
 
 /**
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 18/39] drm/i915: Implement the HDCP2.2 support for HDMI

2018-09-27 Thread Ramalingam C
Implements the HDMI adaptation specific HDCP2.2 operations.

Basically these are DDC read and write for authenticating through
HDCP2.2 messages.

v2:
  Rebased.
v3:
  No Changes.
v4:
  No more special handling of Gmbus burst read for AKE_SEND_CERT.
  Style fixed with few naming. [Uma]
  %s/PARING/PAIRING
v5:
  msg_sz is initialized at definition.
  Lookup table is defined for HDMI HDCP2.2 msgs [Daniel].
v6:
  Rebased.
v7:
  Make a function as inline [Uma]
  %s/uintxx_t/uxx

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/gpu/drm/i915/intel_hdmi.c | 190 ++
 1 file changed, 190 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c 
b/drivers/gpu/drm/i915/intel_hdmi.c
index dff62df6d704..a6fe0e42d348 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1120,6 +1121,190 @@ bool intel_hdmi_hdcp_check_link(struct 
intel_digital_port *intel_dig_port)
return true;
 }
 
+static struct hdcp2_hdmi_msg_data {
+   u8 msg_id;
+   u32 timeout;
+   u32 timeout2;
+   } hdcp2_msg_data[] = {
+   {HDCP_2_2_AKE_INIT, 0, 0},
+   {HDCP_2_2_AKE_SEND_CERT, HDCP_2_2_CERT_TIMEOUT_MS, 0},
+   {HDCP_2_2_AKE_NO_STORED_KM, 0, 0},
+   {HDCP_2_2_AKE_STORED_KM, 0, 0},
+   {HDCP_2_2_AKE_SEND_HPRIME, HDCP_2_2_HPRIME_PAIRED_TIMEOUT_MS,
+   HDCP_2_2_HPRIME_NO_PAIRED_TIMEOUT_MS},
+   {HDCP_2_2_AKE_SEND_PAIRING_INFO, HDCP_2_2_PAIRING_TIMEOUT_MS,
+   0},
+   {HDCP_2_2_LC_INIT, 0, 0},
+   {HDCP_2_2_LC_SEND_LPRIME, HDCP_2_2_HDMI_LPRIME_TIMEOUT_MS, 0},
+   {HDCP_2_2_SKE_SEND_EKS, 0, 0},
+   {HDCP_2_2_REP_SEND_RECVID_LIST,
+   HDCP_2_2_RECVID_LIST_TIMEOUT_MS, 0},
+   {HDCP_2_2_REP_SEND_ACK, 0, 0},
+   {HDCP_2_2_REP_STREAM_MANAGE, 0, 0},
+   {HDCP_2_2_REP_STREAM_READY, HDCP_2_2_STREAM_READY_TIMEOUT_MS,
+   0},
+   };
+
+static
+int intel_hdmi_hdcp2_read_rx_status(struct intel_digital_port *intel_dig_port,
+   uint8_t *rx_status)
+{
+   return intel_hdmi_hdcp_read(intel_dig_port,
+   HDCP_2_2_HDMI_REG_RXSTATUS_OFFSET,
+   rx_status,
+   HDCP_2_2_HDMI_RXSTATUS_LEN);
+}
+
+static int get_hdcp2_msg_timeout(u8 msg_id, bool is_paired)
+{
+   int i;
+
+   for (i = 0; i < sizeof(hdcp2_msg_data); i++)
+   if (hdcp2_msg_data[i].msg_id == msg_id &&
+   (msg_id != HDCP_2_2_AKE_SEND_HPRIME || is_paired))
+   return hdcp2_msg_data[i].timeout;
+   else if (hdcp2_msg_data[i].msg_id == msg_id)
+   return hdcp2_msg_data[i].timeout2;
+
+   return -EINVAL;
+}
+
+static inline
+int hdcp2_detect_msg_availability(struct intel_digital_port 
*intel_digital_port,
+ u8 msg_id, bool *msg_ready,
+ ssize_t *msg_sz)
+{
+   u8 rx_status[HDCP_2_2_HDMI_RXSTATUS_LEN];
+   int ret;
+
+   ret = intel_hdmi_hdcp2_read_rx_status(intel_digital_port, rx_status);
+   if (ret < 0) {
+   DRM_DEBUG_KMS("rx_status read failed. Err %d\n", ret);
+   return ret;
+   }
+
+   *msg_sz = ((HDCP_2_2_HDMI_RXSTATUS_MSG_SZ_HI(rx_status[1]) << 8) |
+ rx_status[0]);
+
+   if (msg_id == HDCP_2_2_REP_SEND_RECVID_LIST)
+   *msg_ready = (HDCP_2_2_HDMI_RXSTATUS_READY(rx_status[1]) &&
+*msg_sz);
+   else
+   *msg_ready = *msg_sz;
+
+   return 0;
+}
+
+static ssize_t
+intel_hdmi_hdcp2_wait_for_msg(struct intel_digital_port *intel_dig_port,
+ u8 msg_id, bool paired)
+{
+   bool msg_ready = false;
+   int timeout, ret;
+   ssize_t msg_sz = 0;
+
+   timeout = get_hdcp2_msg_timeout(msg_id, paired);
+   if (timeout < 0)
+   return timeout;
+
+   ret = __wait_for(ret = hdcp2_detect_msg_availability(intel_dig_port,
+msg_id, &msg_ready,
+&msg_sz),
+!ret && msg_ready && msg_sz, timeout * 1000,
+1000, 5 * 1000);
+   if (ret)
+   DRM_ERROR("msg_id: %d, ret: %d, timeout: %d\n",
+ msg_id, ret, timeout);
+
+   return ret ? ret : msg_sz;
+}
+
+static
+int intel_hdmi_hdcp2_write_msg(struct intel_digital_port *intel_dig_port,
+  void *buf, size_t size)
+{
+   unsigned int offset;
+
+   offset = HDCP_2_2_HDMI_REG_WR_MSG_OFFSET;
+   r

[PATCH v7 24/39] misc/mei/hdcp: Define ME FW interface for HDCP2.2

2018-09-27 Thread Ramalingam C
Defines the HDCP specific ME FW interfaces such as Request CMDs,
payload structure for CMDs and their response status codes.

This patch defines payload size(Excluding the Header)for each WIRED
HDCP2.2 CMDs.

v2:
  Rebased.
v3:
  Extra comments are removed.
v4:
  %s/\/\*\*/\/\*
v5:
  Extra lines are removed.
v6:
  No change.
v7:
  Remove redundant text from the License header
  %s/LPRIME_HALF/V_PRIME_HALF
  %s/uintxx_t/uxx

Signed-off-by: Ramalingam C 
---
 drivers/misc/mei/hdcp/mei_hdcp.h | 366 +++
 1 file changed, 366 insertions(+)
 create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.h

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.h b/drivers/misc/mei/hdcp/mei_hdcp.h
new file mode 100644
index ..02013893397c
--- /dev/null
+++ b/drivers/misc/mei/hdcp/mei_hdcp.h
@@ -0,0 +1,366 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/*
+ * Copyright © 2017-2018 Intel Corporation
+ *
+ * Authors:
+ * Ramalingam C 
+ */
+
+#ifndef __MEI_HDCP_H__
+#define __MEI_HDCP_H__
+
+#include 
+
+/* me_hdcp_status: Enumeration of all HDCP Status Codes */
+enum me_hdcp_status {
+   ME_HDCP_STATUS_SUCCESS  = 0x,
+
+   /* WiDi Generic Status Codes */
+   ME_HDCP_STATUS_INTERNAL_ERROR   = 0x1000,
+   ME_HDCP_STATUS_UNKNOWN_ERROR= 0x1001,
+   ME_HDCP_STATUS_INCORRECT_API_VERSION= 0x1002,
+   ME_HDCP_STATUS_INVALID_FUNCTION = 0x1003,
+   ME_HDCP_STATUS_INVALID_BUFFER_LENGTH= 0x1004,
+   ME_HDCP_STATUS_INVALID_PARAMS   = 0x1005,
+   ME_HDCP_STATUS_AUTHENTICATION_FAILED= 0x1006,
+
+   /* WiDi Status Codes */
+   ME_HDCP_INVALID_SESSION_STATE   = 0x6000,
+   ME_HDCP_SRM_FRAGMENT_UNEXPECTED = 0x6001,
+   ME_HDCP_SRM_INVALID_LENGTH  = 0x6002,
+   ME_HDCP_SRM_FRAGMENT_OFFSET_INVALID = 0x6003,
+   ME_HDCP_SRM_VERIFICATION_FAILED = 0x6004,
+   ME_HDCP_SRM_VERSION_TOO_OLD = 0x6005,
+   ME_HDCP_RX_CERT_VERIFICATION_FAILED = 0x6006,
+   ME_HDCP_RX_REVOKED  = 0x6007,
+   ME_HDCP_H_VERIFICATION_FAILED   = 0x6008,
+   ME_HDCP_REPEATER_CHECK_UNEXPECTED   = 0x6009,
+   ME_HDCP_TOPOLOGY_MAX_EXCEEDED   = 0x600A,
+   ME_HDCP_V_VERIFICATION_FAILED   = 0x600B,
+   ME_HDCP_L_VERIFICATION_FAILED   = 0x600C,
+   ME_HDCP_STREAM_KEY_ALLOC_FAILED = 0x600D,
+   ME_HDCP_BASE_KEY_RESET_FAILED   = 0x600E,
+   ME_HDCP_NONCE_GENERATION_FAILED = 0x600F,
+   ME_HDCP_STATUS_INVALID_E_KEY_STATE  = 0x6010,
+   ME_HDCP_STATUS_INVALID_CS_ICV   = 0x6011,
+   ME_HDCP_STATUS_INVALID_KB_KEY_STATE = 0x6012,
+   ME_HDCP_STATUS_INVALID_PAVP_MODE_ICV= 0x6013,
+   ME_HDCP_STATUS_INVALID_PAVP_MODE= 0x6014,
+   ME_HDCP_STATUS_LC_MAX_ATTEMPTS  = 0x6015,
+
+   /* New status for HDCP 2.1 */
+   ME_HDCP_STATUS_MISMATCH_IN_M= 0x6016,
+
+   /* New status code for HDCP 2.2 Rx */
+   ME_HDCP_STATUS_RX_PROV_NOT_ALLOWED  = 0x6017,
+   ME_HDCP_STATUS_RX_PROV_WRONG_SUBJECT= 0x6018,
+   ME_HDCP_RX_NEEDS_PROVISIONING   = 0x6019,
+   ME_HDCP_BKSV_ICV_AUTH_FAILED= 0x6020,
+   ME_HDCP_STATUS_INVALID_STREAM_ID= 0x6021,
+   ME_HDCP_STATUS_CHAIN_NOT_INITIALIZED= 0x6022,
+   ME_HDCP_FAIL_NOT_EXPECTED   = 0x6023,
+   ME_HDCP_FAIL_HDCP_OFF   = 0x6024,
+   ME_HDCP_FAIL_INVALID_PAVP_MEMORY_MODE   = 0x6025,
+   ME_HDCP_FAIL_AES_ECB_FAILURE= 0x6026,
+   ME_HDCP_FEATURE_NOT_SUPPORTED   = 0x6027,
+   ME_HDCP_DMA_READ_ERROR  = 0x6028,
+   ME_HDCP_DMA_WRITE_ERROR = 0x6029,
+   ME_HDCP_FAIL_INVALID_PACKET_SIZE= 0x6030,
+   ME_HDCP_H264_PARSING_ERROR  = 0x6031,
+   ME_HDCP_HDCP2_ERRATA_VIDEO_VIOLATION= 0x6032,
+   ME_HDCP_HDCP2_ERRATA_AUDIO_VIOLATION= 0x6033,
+   ME_HDCP_TX_ACTIVE_ERROR = 0x6034,
+   ME_HDCP_MODE_CHANGE_ERROR   = 0x6035,
+   ME_HDCP_STREAM_TYPE_ERROR   = 0x6036,
+   ME_HDCP_STREAM_MANAGE_NOT_POSSIBLE  = 0x6037,
+
+   ME_HDCP_STATUS_PORT_INVALID_COMMAND = 0x6038,
+   ME_HDCP_STATUS_UNSUPPORTED_PROTOCOL = 0x6039,
+   ME_HDCP_STATUS_INVALID_PORT_INDEX   = 0x603a,
+   ME_HDCP_STATUS_TX_AUTH_NEEDED   = 0x603b,
+   ME_HDCP_STATUS_NOT_INTEGRATED_PORT  = 0x603c,
+   ME_HDCP_STATUS_SESSION_MAX_REACHED  = 0x603d,
+
+   /* hdcp capable bit is not set in rx_caps(error is unique to DP) */
+   ME_HDCP_STATUS_NOT_HDCP_CAPABLE = 0x6041,
+
+   ME_HDCP_STATUS_INVALID_STREAM_COUNT = 0x6042,
+};
+
+#define HDCP_API_VERSION   0x0001
+
+#define HDCP_M_LEN 16
+#define

[PATCH v7 25/39] misc/mei/hdcp: Initiate Wired HDCP2.2 Tx Session

2018-09-27 Thread Ramalingam C
Request ME FW to start the HDCP2.2 session for an intel port.
Prepares payloads for command WIRED_INITIATE_HDCP2_SESSION and sends
to ME FW.

On Success, ME FW will start a HDCP2.2 session for the port and
provides the content for HDCP2.2 AKE_Init message.

v2:
  Rebased.
v3:
  cldev is add as a separate parameter [Tomas]
  Redundant comment and typecast are removed [Tomas]
v4:
  %zd is used for size [Alexander]
  %s/return -1/return -EIO [Alexander]
  Spellings in commit msg is fixed [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the rb-ed by.
  Realigning the patches in the series.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 85 
 1 file changed, 85 insertions(+)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index d4067d17f382..0c85d4782949 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -12,6 +12,91 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+
+#include "mei_hdcp.h"
+
+/*
+ * mei_initiate_hdcp2_session:
+ * Function to start a Wired HDCP2.2 Tx Session with ME FW
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * ake_data: ptr to store AKE_Init
+ *
+ * Returns 0 on Success, <0 on Failure.
+ */
+static int mei_initiate_hdcp2_session(struct mei_cl_device *cldev,
+ struct mei_hdcp_data *data,
+ struct hdcp2_ake_init *ake_data)
+{
+   struct wired_cmd_initiate_hdcp2_session_in session_init_in = { { 0 } };
+   struct wired_cmd_initiate_hdcp2_session_out
+   session_init_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data || !ake_data)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   session_init_in.header.api_version = HDCP_API_VERSION;
+   session_init_in.header.command_id = WIRED_INITIATE_HDCP2_SESSION;
+   session_init_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   session_init_in.header.buffer_len =
+   WIRED_CMD_BUF_LEN_INITIATE_HDCP2_SESSION_IN;
+
+   session_init_in.port.integrated_port_type = data->port_type;
+   session_init_in.port.physical_port = data->port;
+   session_init_in.protocol = (uint8_t)data->protocol;
+
+   byte = mei_cldev_send(cldev, (u8 *)&session_init_in,
+ sizeof(session_init_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&session_init_out,
+ sizeof(session_init_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (session_init_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
+   WIRED_INITIATE_HDCP2_SESSION,
+   session_init_out.header.status);
+   return -EIO;
+   }
+
+   ake_data->msg_id = HDCP_2_2_AKE_INIT;
+   ake_data->tx_caps = session_init_out.tx_caps;
+   memcpy(ake_data->r_tx, session_init_out.r_tx,
+  sizeof(session_init_out.r_tx));
+
+   return 0;
+}
+
+static __attribute__((unused))
+struct i915_hdcp_component_ops mei_hdcp_ops = {
+   .owner  = THIS_MODULE,
+   .initiate_hdcp2_session = mei_initiate_hdcp2_session,
+   .verify_receiver_cert_prepare_km= NULL,
+   .verify_hprime  = NULL,
+   .store_pairing_info = NULL,
+   .initiate_locality_check= NULL,
+   .verify_lprime  = NULL,
+   .get_session_key= NULL,
+   .repeater_check_flow_prepare_ack= NULL,
+   .verify_mprime  = NULL,
+   .enable_hdcp_authentication = NULL,
+   .close_hdcp_session = NULL,
+};
 
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
  const struct mei_cl_device_id *id)
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 26/39] misc/mei/hdcp: Verify Receiver Cert and prepare km

2018-09-27 Thread Ramalingam C
Requests for verification for receiver certification and also the
preparation for next AKE auth message with km.

On Success ME FW validate the HDCP2.2 receivers certificate and do the
revocation check on the receiver ID. AKE_Stored_Km will be prepared if
the receiver is already paired, else AKE_No_Stored_Km will be prepared.

Here AKE_Stored_Km and AKE_No_Stored_Km are HDCP2.2 protocol msgs.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd is used for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebasing.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 85 +++-
 1 file changed, 84 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index 0c85d4782949..d9b457074d3b 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -82,11 +82,94 @@ static int mei_initiate_hdcp2_session(struct mei_cl_device 
*cldev,
return 0;
 }
 
+/*
+ * mei_verify_receiver_cert_prepare_km:
+ * Function to verify the Receiver Certificate AKE_Send_Cert
+ * and prepare AKE_Stored_Km or AKE_No_Stored_Km
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * rx_cert : Pointer for AKE_Send_Cert
+ * km_stored   : Pointer for pairing status flag
+ * ek_pub_km   : Pointer for output msg
+ * msg_sz  : Pointer for size of AKE_X_Km
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int
+mei_verify_receiver_cert_prepare_km(struct mei_cl_device *cldev,
+   struct mei_hdcp_data *data,
+   struct hdcp2_ake_send_cert *rx_cert,
+   bool *km_stored,
+   struct hdcp2_ake_no_stored_km *ek_pub_km,
+   size_t *msg_sz)
+{
+   struct wired_cmd_verify_receiver_cert_in verify_rxcert_in = { { 0 } };
+   struct wired_cmd_verify_receiver_cert_out verify_rxcert_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data || !rx_cert || !km_stored || !ek_pub_km || !msg_sz)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   verify_rxcert_in.header.api_version = HDCP_API_VERSION;
+   verify_rxcert_in.header.command_id = WIRED_VERIFY_RECEIVER_CERT;
+   verify_rxcert_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   verify_rxcert_in.header.buffer_len =
+   WIRED_CMD_BUF_LEN_VERIFY_RECEIVER_CERT_IN;
+
+   verify_rxcert_in.port.integrated_port_type = data->port_type;
+   verify_rxcert_in.port.physical_port = data->port;
+
+   memcpy(&verify_rxcert_in.cert_rx, &rx_cert->cert_rx,
+  sizeof(rx_cert->cert_rx));
+   memcpy(verify_rxcert_in.r_rx, &rx_cert->r_rx, sizeof(rx_cert->r_rx));
+   memcpy(verify_rxcert_in.rx_caps, rx_cert->rx_caps, HDCP_2_2_RXCAPS_LEN);
+
+   byte = mei_cldev_send(cldev, (u8 *)&verify_rxcert_in,
+ sizeof(verify_rxcert_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed: %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&verify_rxcert_out,
+ sizeof(verify_rxcert_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed: %zd\n", byte);
+   return byte;
+   }
+
+   if (verify_rxcert_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
+   WIRED_VERIFY_RECEIVER_CERT,
+   verify_rxcert_out.header.status);
+   return -EIO;
+   }
+
+   *km_stored = verify_rxcert_out.km_stored;
+   if (verify_rxcert_out.km_stored) {
+   ek_pub_km->msg_id = HDCP_2_2_AKE_STORED_KM;
+   *msg_sz = sizeof(struct hdcp2_ake_stored_km);
+   } else {
+   ek_pub_km->msg_id = HDCP_2_2_AKE_NO_STORED_KM;
+   *msg_sz = sizeof(struct hdcp2_ake_no_stored_km);
+   }
+
+   memcpy(ek_pub_km->e_kpub_km, &verify_rxcert_out.ekm_buff,
+  sizeof(verify_rxcert_out.ekm_buff));
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
.initiate_hdcp2_session = mei_initiate_hdcp2_session,
-   .verify_receiver_cert_prepare_km= NULL,
+   .verify_receiver_cert_prepare_km=
+   mei_verify_receiver_cert_prepare_km,
.verify_hprime  = NULL,
.store_pairing_info  

[PATCH v7 22/39] mei: bus: export to_mei_cl_device for mei client device drivers

2018-09-27 Thread Ramalingam C
From: Tomas Winkler 

Export to_mei_cl_device macro, it is needed also in mei client drivers.

Signed-off-by: Tomas Winkler 
---
 drivers/misc/mei/bus.c | 1 -
 include/linux/mei_cl_bus.h | 2 ++
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index fc3872fe7b25..e5456faf00e6 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -28,7 +28,6 @@
 #include "client.h"
 
 #define to_mei_cl_driver(d) container_of(d, struct mei_cl_driver, driver)
-#define to_mei_cl_device(d) container_of(d, struct mei_cl_device, dev)
 
 /**
  * __mei_cl_send - internal client send (write)
diff --git a/include/linux/mei_cl_bus.h b/include/linux/mei_cl_bus.h
index 7fde40e17c8b..03b6ba2a63f8 100644
--- a/include/linux/mei_cl_bus.h
+++ b/include/linux/mei_cl_bus.h
@@ -55,6 +55,8 @@ struct mei_cl_device {
void *priv_data;
 };
 
+#define to_mei_cl_device(d) container_of(d, struct mei_cl_device, dev)
+
 struct mei_cl_driver {
struct device_driver driver;
const char *name;
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 27/39] misc/mei/hdcp: Verify H_prime

2018-09-27 Thread Ramalingam C
Requests for the verification of AKE_Send_H_prime.

ME will calculate the H and comparing it with received H_Prime.
The result will be returned as status.

Here AKE_Send_H_prime is a HDCP2.2 Authentication msg.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  Styles and typos fixed [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebasing.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 61 +++-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index d9b457074d3b..28e5a86b29a5 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -164,13 +164,72 @@ mei_verify_receiver_cert_prepare_km(struct mei_cl_device 
*cldev,
return 0;
 }
 
+/*
+ * mei_verify_hprime:
+ * Function to verify AKE_Send_H_prime received, through ME FW.
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * rx_hprime   : Pointer for AKE_Send_H_prime
+ * hprime_sz   : Input buffer size
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int mei_verify_hprime(struct mei_cl_device *cldev,
+struct mei_hdcp_data *data,
+struct hdcp2_ake_send_hprime *rx_hprime)
+{
+   struct wired_cmd_ake_send_hprime_in send_hprime_in = { { 0 } };
+   struct wired_cmd_ake_send_hprime_out send_hprime_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data || !rx_hprime)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   send_hprime_in.header.api_version = HDCP_API_VERSION;
+   send_hprime_in.header.command_id = WIRED_AKE_SEND_HPRIME;
+   send_hprime_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   send_hprime_in.header.buffer_len = WIRED_CMD_BUF_LEN_AKE_SEND_HPRIME_IN;
+
+   send_hprime_in.port.integrated_port_type = data->port_type;
+   send_hprime_in.port.physical_port = data->port;
+
+   memcpy(send_hprime_in.h_prime, rx_hprime->h_prime,
+  sizeof(rx_hprime->h_prime));
+
+   byte = mei_cldev_send(cldev, (u8 *)&send_hprime_in,
+ sizeof(send_hprime_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&send_hprime_out,
+ sizeof(send_hprime_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (send_hprime_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X Failed. Status: 0x%X\n",
+   WIRED_AKE_SEND_HPRIME, send_hprime_out.header.status);
+   return -EIO;
+   }
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
.initiate_hdcp2_session = mei_initiate_hdcp2_session,
.verify_receiver_cert_prepare_km=
mei_verify_receiver_cert_prepare_km,
-   .verify_hprime  = NULL,
+   .verify_hprime  = mei_verify_hprime,
.store_pairing_info = NULL,
.initiate_locality_check= NULL,
.verify_lprime  = NULL,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 23/39] misc/mei/hdcp: Client driver for HDCP application

2018-09-27 Thread Ramalingam C
ME FW is contributes a vital role in HDCP2.2 authentication.
HDCP2.2 driver needs to communicate to ME FW for each step of the
HDCP2.2 authentication.

ME FW prepare and HDCP2.2 authentication  parameters and encrypt them
as per spec. With such parameter Driver prepares HDCP2.2 auth messages
and communicate with HDCP2.2 sink.

Similarly HDCP2. sink's response is shared with ME FW for decrypt and
verification.

Once All the steps of HDCP2.2 authentications are complete on driver's
request ME FW will configure the port as authenticated and supply the
HDCP keys to the Gen HW for encryption.

Only after this stage HDCP2.2 driver can start the HDCP2.2 encryption
for a port.

ME FW is interfaced to kernel through MEI Bus Driver. To obtain the
HDCP2.2 services from the ME FW through MEI Bus driver MEI Client
Driver is developed.

With this change MEI_HDCP drivers selected by I915 by default.
In case if we want to exclude the mei_hdcp compilation, we need to
introduce a new config called HDCP2.2. Using such CONFIG var we could
control the compilation of the HDCP2.2 code in I915 and also the
compilation of the MEI_HDCP.

v2:
  hdcp files are moved to drivers/misc/mei/hdcp/ [Tomas]
v3:
  Squashed the Kbuild support [Tomas]
  UUID renamed and Module License is modified [Tomas]
  drv_data is set to null at remove [Tomas]
v4:
  Module name is changed to "MEI HDCP"
  I915 Selects the MEI_HDCP
v5:
  No Change.
v6:
  No Change.
v7:
  Remove redundant text from the License header
  Fix malformed licence
  Removed the drv_data resetting.

Signed-off-by: Ramalingam C 
Signed-off-by: Tomas Winkler 
---
 drivers/misc/mei/Kconfig |  7 ++
 drivers/misc/mei/Makefile|  2 ++
 drivers/misc/mei/hdcp/Makefile   |  7 ++
 drivers/misc/mei/hdcp/mei_hdcp.c | 54 
 4 files changed, 70 insertions(+)
 create mode 100644 drivers/misc/mei/hdcp/Makefile
 create mode 100644 drivers/misc/mei/hdcp/mei_hdcp.c

diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig
index c49e1d2269af..9c518b7f0011 100644
--- a/drivers/misc/mei/Kconfig
+++ b/drivers/misc/mei/Kconfig
@@ -43,3 +43,10 @@ config INTEL_MEI_TXE
 
  Supported SoCs:
  Intel Bay Trail
+
+config INTEL_MEI_HDCP
+   tristate "Intel HDCP2.2 services of ME Interface"
+   select INTEL_MEI_ME
+   depends on DRM_I915
+   help
+ MEI Support for HDCP2.2 Services on Intel SoCs.
diff --git a/drivers/misc/mei/Makefile b/drivers/misc/mei/Makefile
index cd6825afa8e1..e64d1212fb85 100644
--- a/drivers/misc/mei/Makefile
+++ b/drivers/misc/mei/Makefile
@@ -23,3 +23,5 @@ mei-txe-objs += hw-txe.o
 
 mei-$(CONFIG_EVENT_TRACING) += mei-trace.o
 CFLAGS_mei-trace.o = -I$(src)
+
+obj-$(CONFIG_INTEL_MEI_HDCP) += hdcp/
diff --git a/drivers/misc/mei/hdcp/Makefile b/drivers/misc/mei/hdcp/Makefile
new file mode 100644
index ..c1a86dd9782b
--- /dev/null
+++ b/drivers/misc/mei/hdcp/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+#
+# Copyright (c) 2017-2018, Intel Corporation.
+#
+# Makefile - HDCP client driver for Intel MEI Bus Driver.
+
+obj-$(CONFIG_INTEL_MEI_HDCP) += mei_hdcp.o
diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
new file mode 100644
index ..d4067d17f382
--- /dev/null
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -0,0 +1,54 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
+/*
+ * Copyright © 2017-2018 Intel Corporation
+ *
+ * Mei_hdcp.c: HDCP client driver for mei bus
+ *
+ * Authors:
+ * Ramalingam C 
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+static int mei_hdcp_probe(struct mei_cl_device *cldev,
+ const struct mei_cl_device_id *id)
+{
+   int ret;
+
+   ret = mei_cldev_enable(cldev);
+   if (ret < 0)
+   dev_err(&cldev->dev, "mei_cldev_enable Failed. %d\n", ret);
+
+   return ret;
+}
+
+static int mei_hdcp_remove(struct mei_cl_device *cldev)
+{
+   return mei_cldev_disable(cldev);
+}
+
+#define MEI_UUID_HDCP  UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, 0xA5, \
+   0x52, 0xD1, 0xC5, 0x4B, \
+   0x62, 0x7F, 0x04)
+
+static struct mei_cl_device_id mei_hdcp_tbl[] = {
+   { .uuid = MEI_UUID_HDCP, .version = MEI_CL_VERSION_ANY },
+   { }
+};
+MODULE_DEVICE_TABLE(mei, mei_hdcp_tbl);
+
+static struct mei_cl_driver mei_hdcp_driver = {
+   .id_table   = mei_hdcp_tbl,
+   .name   = KBUILD_MODNAME,
+   .probe  = mei_hdcp_probe,
+   .remove = mei_hdcp_remove,
+};
+
+module_mei_cl_driver(mei_hdcp_driver);
+
+MODULE_AUTHOR("Intel Corporation");
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_DESCRIPTION("MEI HDCP");
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 31/39] misc/mei/hdcp: Prepare Session Key

2018-09-27 Thread Ramalingam C
Request to ME to prepare the encrypted session key.

On Success, ME provides Encrypted session key. Function populates
the HDCP2.2 authentication msg SKE_Send_Eks.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  Style fixed [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebasing.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 61 +++-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index 3ae50240c656..59ef9086cce4 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -400,6 +400,65 @@ static int mei_verify_lprime(struct mei_cl_device *cldev,
return 0;
 }
 
+/*
+ * mei_get_session_key:
+ * Function to prepare SKE_Send_Eks.
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * ske_data: Pointer for SKE_Send_Eks.
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int mei_get_session_key(struct mei_cl_device *cldev,
+  struct mei_hdcp_data *data,
+  struct hdcp2_ske_send_eks *ske_data)
+{
+   struct wired_cmd_get_session_key_in get_skey_in = { { 0 } };
+   struct wired_cmd_get_session_key_out get_skey_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data || !ske_data)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   get_skey_in.header.api_version = HDCP_API_VERSION;
+   get_skey_in.header.command_id = WIRED_GET_SESSION_KEY;
+   get_skey_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   get_skey_in.header.buffer_len = WIRED_CMD_BUF_LEN_GET_SESSION_KEY_IN;
+
+   get_skey_in.port.integrated_port_type = data->port_type;
+   get_skey_in.port.physical_port = data->port;
+
+   byte = mei_cldev_send(cldev, (u8 *)&get_skey_in, sizeof(get_skey_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&get_skey_out, sizeof(get_skey_out));
+
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (get_skey_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+   WIRED_GET_SESSION_KEY, get_skey_out.header.status);
+   return -EIO;
+   }
+
+   ske_data->msg_id = HDCP_2_2_SKE_SEND_EKS;
+   memcpy(ske_data->e_dkey_ks, get_skey_out.e_dkey_ks,
+  HDCP_2_2_E_DKEY_KS_LEN);
+   memcpy(ske_data->riv, get_skey_out.r_iv, HDCP_2_2_RIV_LEN);
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
@@ -410,7 +469,7 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
.store_pairing_info = mei_store_pairing_info,
.initiate_locality_check= mei_initiate_locality_check,
.verify_lprime  = mei_verify_lprime,
-   .get_session_key= NULL,
+   .get_session_key= mei_get_session_key,
.repeater_check_flow_prepare_ack= NULL,
.verify_mprime  = NULL,
.enable_hdcp_authentication = NULL,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 28/39] misc/mei/hdcp: Store the HDCP Pairing info

2018-09-27 Thread Ramalingam C
Provides Pairing info to ME to store.

Pairing is a process to fast track the subsequent authentication
with the same HDCP sink.

On Success, received HDCP pairing info is stored in non-volatile
memory of ME.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  Style fixed [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebasing.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 63 +++-
 1 file changed, 62 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index 28e5a86b29a5..0dd01ce46833 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -223,6 +223,67 @@ static int mei_verify_hprime(struct mei_cl_device *cldev,
return 0;
 }
 
+/*
+ * mei_store_pairing_info:
+ * Function to store pairing info received from panel
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * pairing_info: Pointer for AKE_Send_Pairing_Info
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int
+mei_store_pairing_info(struct mei_cl_device *cldev,
+  struct mei_hdcp_data *data,
+  struct hdcp2_ake_send_pairing_info *pairing_info)
+{
+   struct wired_cmd_ake_send_pairing_info_in pairing_info_in = { { 0 } };
+   struct wired_cmd_ake_send_pairing_info_out pairing_info_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data || !pairing_info)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   pairing_info_in.header.api_version = HDCP_API_VERSION;
+   pairing_info_in.header.command_id = WIRED_AKE_SEND_PAIRING_INFO;
+   pairing_info_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   pairing_info_in.header.buffer_len =
+   WIRED_CMD_BUF_LEN_SEND_PAIRING_INFO_IN;
+
+   pairing_info_in.port.integrated_port_type = data->port_type;
+   pairing_info_in.port.physical_port = data->port;
+
+   memcpy(pairing_info_in.e_kh_km, pairing_info->e_kh_km,
+  sizeof(pairing_info_in.e_kh_km));
+
+   byte = mei_cldev_send(cldev, (u8 *)&pairing_info_in,
+ sizeof(pairing_info_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&pairing_info_out,
+ sizeof(pairing_info_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (pairing_info_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X failed. Status: 0x%X\n",
+   WIRED_AKE_SEND_PAIRING_INFO,
+   pairing_info_out.header.status);
+   return -EIO;
+   }
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
@@ -230,7 +291,7 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
.verify_receiver_cert_prepare_km=
mei_verify_receiver_cert_prepare_km,
.verify_hprime  = mei_verify_hprime,
-   .store_pairing_info = NULL,
+   .store_pairing_info = mei_store_pairing_info,
.initiate_locality_check= NULL,
.verify_lprime  = NULL,
.get_session_key= NULL,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 29/39] misc/mei/hdcp: Initiate Locality check

2018-09-27 Thread Ramalingam C
Requests ME to start the second stage of HDCP2.2 authentication,
called Locality Check.

On Success, ME FW will provide LC_Init message to send to hdcp sink.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd used for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  Style fixed [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebasing.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 58 +++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index 0dd01ce46833..ab1aed39d5a4 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -284,6 +284,62 @@ mei_store_pairing_info(struct mei_cl_device *cldev,
return 0;
 }
 
+/*
+ * mei_initiate_locality_check:
+ * Function to prepare LC_Init.
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * hdcp2_lc_init   : Pointer for storing LC_Init
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int mei_initiate_locality_check(struct mei_cl_device *cldev,
+  struct mei_hdcp_data *data,
+  struct hdcp2_lc_init *lc_init_data)
+{
+   struct wired_cmd_init_locality_check_in lc_init_in = { { 0 } };
+   struct wired_cmd_init_locality_check_out lc_init_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data || !lc_init_data)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   lc_init_in.header.api_version = HDCP_API_VERSION;
+   lc_init_in.header.command_id = WIRED_INIT_LOCALITY_CHECK;
+   lc_init_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   lc_init_in.header.buffer_len = WIRED_CMD_BUF_LEN_INIT_LOCALITY_CHECK_IN;
+
+   lc_init_in.port.integrated_port_type = data->port_type;
+   lc_init_in.port.physical_port = data->port;
+
+   byte = mei_cldev_send(cldev, (u8 *)&lc_init_in, sizeof(lc_init_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&lc_init_out, sizeof(lc_init_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (lc_init_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X Failed. status: 0x%X\n",
+   WIRED_INIT_LOCALITY_CHECK, lc_init_out.header.status);
+   return -EIO;
+   }
+
+   lc_init_data->msg_id = HDCP_2_2_LC_INIT;
+   memcpy(lc_init_data->r_n, lc_init_out.r_n, HDCP_2_2_RN_LEN);
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
@@ -292,7 +348,7 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
mei_verify_receiver_cert_prepare_km,
.verify_hprime  = mei_verify_hprime,
.store_pairing_info = mei_store_pairing_info,
-   .initiate_locality_check= NULL,
+   .initiate_locality_check= mei_initiate_locality_check,
.verify_lprime  = NULL,
.get_session_key= NULL,
.repeater_check_flow_prepare_ack= NULL,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 32/39] misc/mei/hdcp: Repeater topology verification and ack

2018-09-27 Thread Ramalingam C
Request ME to verify the downstream topology information received.

ME FW will validate the Repeaters receiver id list and
downstream topology.

On Success ME FW will provide the Least Significant
128bits of VPrime, which forms the repeater ack.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  Style and typos fixed [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Rebasing.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 77 +++-
 1 file changed, 76 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index 59ef9086cce4..2911fb6e8ed3 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -459,6 +459,80 @@ static int mei_get_session_key(struct mei_cl_device *cldev,
return 0;
 }
 
+/*
+ * mei_repeater_check_flow_prepare_ack:
+ * Function to validate the Downstream topology and prepare rep_ack.
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * rep_topology: Pointer for Receiver Id List to be validated.
+ * rep_send_ack: Pointer for repeater ack
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int
+mei_repeater_check_flow_prepare_ack(struct mei_cl_device *cldev,
+   struct mei_hdcp_data *data,
+   struct hdcp2_rep_send_receiverid_list
+   *rep_topology,
+   struct hdcp2_rep_send_ack *rep_send_ack)
+{
+   struct wired_cmd_verify_repeater_in verify_repeater_in = { { 0 } };
+   struct wired_cmd_verify_repeater_out verify_repeater_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!rep_topology || !rep_send_ack || !data)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   verify_repeater_in.header.api_version = HDCP_API_VERSION;
+   verify_repeater_in.header.command_id = WIRED_VERIFY_REPEATER;
+   verify_repeater_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   verify_repeater_in.header.buffer_len =
+   WIRED_CMD_BUF_LEN_VERIFY_REPEATER_IN;
+
+   verify_repeater_in.port.integrated_port_type = data->port_type;
+   verify_repeater_in.port.physical_port = data->port;
+
+   memcpy(verify_repeater_in.rx_info, rep_topology->rx_info,
+  HDCP_2_2_RXINFO_LEN);
+   memcpy(verify_repeater_in.seq_num_v, rep_topology->seq_num_v,
+  HDCP_2_2_SEQ_NUM_LEN);
+   memcpy(verify_repeater_in.v_prime, rep_topology->v_prime,
+  HDCP_2_2_V_PRIME_HALF_LEN);
+   memcpy(verify_repeater_in.receiver_ids, rep_topology->receiver_ids,
+  HDCP_2_2_RECEIVER_IDS_MAX_LEN);
+
+   byte = mei_cldev_send(cldev, (u8 *)&verify_repeater_in,
+ sizeof(verify_repeater_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&verify_repeater_out,
+ sizeof(verify_repeater_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (verify_repeater_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+   WIRED_VERIFY_REPEATER,
+   verify_repeater_out.header.status);
+   return -EIO;
+   }
+
+   memcpy(rep_send_ack->v, verify_repeater_out.v,
+  HDCP_2_2_V_PRIME_HALF_LEN);
+   rep_send_ack->msg_id = HDCP_2_2_REP_SEND_ACK;
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
@@ -470,7 +544,8 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
.initiate_locality_check= mei_initiate_locality_check,
.verify_lprime  = mei_verify_lprime,
.get_session_key= mei_get_session_key,
-   .repeater_check_flow_prepare_ack= NULL,
+   .repeater_check_flow_prepare_ack=
+   mei_repeater_check_flow_prepare_ack,
.verify_mprime  = NULL,
.enable_hdcp_authentication = NULL,
.close_hdcp_session = NULL,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 30/39] misc/mei/hdcp: Verify L_prime

2018-09-27 Thread Ramalingam C
Request to ME to verify the LPrime received from HDCP sink.

On Success, ME FW will verify the received Lprime by calculating and
comparing with L.

This represents the completion of Locality Check.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  Style fixed [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebasing.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 62 +++-
 1 file changed, 61 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index ab1aed39d5a4..3ae50240c656 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -340,6 +340,66 @@ static int mei_initiate_locality_check(struct 
mei_cl_device *cldev,
return 0;
 }
 
+/*
+ * mei_verify_lprime:
+ * Function to verify lprime.
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * rx_lprime   : Pointer for LC_Send_L_prime
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int mei_verify_lprime(struct mei_cl_device *cldev,
+struct mei_hdcp_data *data,
+struct hdcp2_lc_send_lprime *rx_lprime)
+{
+   struct wired_cmd_validate_locality_in verify_lprime_in = { { 0 } };
+   struct wired_cmd_validate_locality_out verify_lprime_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data || !rx_lprime)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   verify_lprime_in.header.api_version = HDCP_API_VERSION;
+   verify_lprime_in.header.command_id = WIRED_VALIDATE_LOCALITY;
+   verify_lprime_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   verify_lprime_in.header.buffer_len =
+   WIRED_CMD_BUF_LEN_VALIDATE_LOCALITY_IN;
+
+   verify_lprime_in.port.integrated_port_type = data->port_type;
+   verify_lprime_in.port.physical_port = data->port;
+
+   memcpy(verify_lprime_in.l_prime, rx_lprime->l_prime,
+  sizeof(rx_lprime->l_prime));
+
+   byte = mei_cldev_send(cldev, (u8 *)&verify_lprime_in,
+ sizeof(verify_lprime_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&verify_lprime_out,
+ sizeof(verify_lprime_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (verify_lprime_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+   WIRED_VALIDATE_LOCALITY,
+   verify_lprime_out.header.status);
+   return -EIO;
+   }
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
@@ -349,7 +409,7 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
.verify_hprime  = mei_verify_hprime,
.store_pairing_info = mei_store_pairing_info,
.initiate_locality_check= mei_initiate_locality_check,
-   .verify_lprime  = NULL,
+   .verify_lprime  = mei_verify_lprime,
.get_session_key= NULL,
.repeater_check_flow_prepare_ack= NULL,
.verify_mprime  = NULL,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 34/39] misc/mei/hdcp: Enabling the HDCP authentication

2018-09-27 Thread Ramalingam C
Request to ME to configure a port as authenticated.

On Success, ME FW will mark the port as authenticated and provides
HDCP cipher with the encryption keys.

Enabling the Authentication can be requested once all stages of
HDCP2.2 authentication is completed by interacting with ME FW.

Only after this stage, driver can enable the HDCP encryption for
the port, through HW registers.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  Style and typos fixed [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebased.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 57 +++-
 1 file changed, 56 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index 80282f852819..fe46bfa3e8a7 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -601,6 +601,60 @@ static int mei_verify_mprime(struct mei_cl_device *cldev,
return 0;
 }
 
+/*
+ * mei_enable_hdcp_authentication:
+ * Function to request ME FW to mark a port as authenticated.
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int mei_enable_hdcp_authentication(struct mei_cl_device *cldev,
+ struct mei_hdcp_data *data)
+{
+   struct wired_cmd_enable_auth_in enable_auth_in = { { 0 } };
+   struct wired_cmd_enable_auth_out enable_auth_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   enable_auth_in.header.api_version = HDCP_API_VERSION;
+   enable_auth_in.header.command_id = WIRED_ENABLE_AUTH;
+   enable_auth_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   enable_auth_in.header.buffer_len = WIRED_CMD_BUF_LEN_ENABLE_AUTH_IN;
+
+   enable_auth_in.port.integrated_port_type = data->port_type;
+   enable_auth_in.port.physical_port = data->port;
+   enable_auth_in.stream_type = data->streams[0].stream_type;
+
+   byte = mei_cldev_send(cldev, (u8 *)&enable_auth_in,
+ sizeof(enable_auth_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&enable_auth_out,
+ sizeof(enable_auth_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (enable_auth_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+   WIRED_ENABLE_AUTH, enable_auth_out.header.status);
+   return -EIO;
+   }
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
@@ -615,7 +669,8 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
.repeater_check_flow_prepare_ack=
mei_repeater_check_flow_prepare_ack,
.verify_mprime  = mei_verify_mprime,
-   .enable_hdcp_authentication = NULL,
+   .enable_hdcp_authentication =
+   mei_enable_hdcp_authentication,
.close_hdcp_session = NULL,
 };
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 33/39] misc/mei/hdcp: Verify M_prime

2018-09-27 Thread Ramalingam C
Request to ME to verify the M_Prime received from the HDCP sink.

ME FW will calculate the M and compare with M_prime received
as part of RepeaterAuth_Stream_Ready, which is HDCP2.2 protocol msg.

On successful completion of this stage, downstream propagation of
the stream management info is completed.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  endianness conversion func is moved to drm_hdcp.h [Uma]
v5:
  Rebased.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebasing.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 70 +++-
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index 2911fb6e8ed3..80282f852819 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -533,6 +533,74 @@ mei_repeater_check_flow_prepare_ack(struct mei_cl_device 
*cldev,
return 0;
 }
 
+/*
+ * mei_verify_mprime:
+ * Function to verify mprime.
+ *
+ * cldev   : Pointer for mei client device
+ * data: Intel HW specific Data
+ * stream_ready: pointer for RepeaterAuth_Stream_Ready message.
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int mei_verify_mprime(struct mei_cl_device *cldev,
+struct mei_hdcp_data *data,
+struct hdcp2_rep_stream_ready *stream_ready)
+{
+   struct wired_cmd_repeater_auth_stream_req_in
+   verify_mprime_in = { { 0 } };
+   struct wired_cmd_repeater_auth_stream_req_out
+   verify_mprime_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!stream_ready || !data)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   verify_mprime_in.header.api_version = HDCP_API_VERSION;
+   verify_mprime_in.header.command_id = WIRED_REPEATER_AUTH_STREAM_REQ;
+   verify_mprime_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   verify_mprime_in.header.buffer_len =
+   WIRED_CMD_BUF_LEN_REPEATER_AUTH_STREAM_REQ_MIN_IN;
+
+   verify_mprime_in.port.integrated_port_type = data->port_type;
+   verify_mprime_in.port.physical_port = data->port;
+
+   memcpy(verify_mprime_in.m_prime, stream_ready->m_prime,
+  HDCP_2_2_MPRIME_LEN);
+   reverse_endianness((u8 *)&verify_mprime_in.seq_num_m,
+  HDCP_2_2_SEQ_NUM_LEN, (u8 *)&data->seq_num_m);
+   memcpy(verify_mprime_in.streams, data->streams,
+  (data->k * sizeof(struct hdcp2_streamid_type)));
+
+   verify_mprime_in.k = __swab16(data->k);
+
+   byte = mei_cldev_send(cldev, (u8 *)&verify_mprime_in,
+ sizeof(verify_mprime_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&verify_mprime_out,
+ sizeof(verify_mprime_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (verify_mprime_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "ME cmd 0x%08X failed. status: 0x%X\n",
+   WIRED_REPEATER_AUTH_STREAM_REQ,
+   verify_mprime_out.header.status);
+   return -EIO;
+   }
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
@@ -546,7 +614,7 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
.get_session_key= mei_get_session_key,
.repeater_check_flow_prepare_ack=
mei_repeater_check_flow_prepare_ack,
-   .verify_mprime  = NULL,
+   .verify_mprime  = mei_verify_mprime,
.enable_hdcp_authentication = NULL,
.close_hdcp_session = NULL,
 };
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 38/39] drm/i915: Fix KBL HDCP2.2 encrypt status signalling

2018-09-27 Thread Ramalingam C
Implement the required WA sequence for KBL to fix the
incorrect positioning of the window of oppurtunity and enc_en
signalling.

Signed-off-by: Ramalingam C 
---
 drivers/gpu/drm/i915/intel_hdcp.c | 29 +
 1 file changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/i915/intel_hdcp.c 
b/drivers/gpu/drm/i915/intel_hdcp.c
index 715649141206..3de872864324 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "intel_drv.h"
 #include "i915_reg.h"
@@ -25,6 +26,27 @@
 static
 struct intel_digital_port *conn_to_dig_port(struct intel_connector *connector);
 
+static void kbl_repositioning_enc_en_signal(struct intel_connector *connector)
+{
+   struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
+   struct intel_digital_port *intel_dig_port = conn_to_dig_port(connector);
+   struct intel_hdcp *hdcp = &connector->hdcp;
+   struct drm_crtc *crtc = connector->base.state->crtc;
+   struct intel_crtc *intel_crtc = container_of(crtc,
+struct intel_crtc, base);
+   u32 scanline;
+
+   for (;;) {
+   scanline = I915_READ(PIPEDSL(intel_crtc->pipe));
+   if (scanline > 100 && scanline < 200)
+   break;
+   usleep_range(25, 50);
+   }
+
+   hdcp->shim->toggle_signalling(intel_dig_port, false);
+   hdcp->shim->toggle_signalling(intel_dig_port, true);
+}
+
 static
 bool intel_hdcp_is_ksv_valid(u8 *ksv)
 {
@@ -1427,6 +1449,13 @@ static int hdcp2_enable_encryption(struct 
intel_connector *connector)
}
 
if (I915_READ(HDCP2_STATUS_DDI(port)) & LINK_AUTH_STATUS) {
+   /*
+* WA: To fix incorrect positioning of the window of
+* opportunity and enc_en signalling in KABYLAKE.
+*/
+   if (IS_KABYLAKE(dev_priv) && hdcp->shim->toggle_signalling)
+   kbl_repositioning_enc_en_signal(connector);
+
/* Link is Authenticated. Now set for Encryption */
I915_WRITE(HDCP2_CTL_DDI(port),
   I915_READ(HDCP2_CTL_DDI(port)) |
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 36/39] misc/mei/hdcp: Component framework for I915 Interface

2018-09-27 Thread Ramalingam C
Mei hdcp driver is designed as component slave for the I915 component
master.

v2:
  Rebased.
v3:
  Notifier chain is adopted for cldev state update [Tomas]
v4:
  Made static dummy functions as inline in mei_hdcp.h
  API for polling client device status
  IS_ENABLED used in header, for config status for mei_hdcp.
v5:
  Replacing the notifier with component framework. [Daniel]
v6:
  Rebased on the I915 comp master redesign.
v7:
  mei_hdcp_component_registered is made static [Uma]
  Need for global static variable mei_cldev is removed.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 68 +---
 1 file changed, 64 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index 993d46b3eda7..37e64fcb1388 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -13,11 +13,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include "mei_hdcp.h"
 
+static bool mei_hdcp_component_registered;
+
 /*
  * mei_initiate_hdcp2_session:
  * Function to start a Wired HDCP2.2 Tx Session with ME FW
@@ -709,8 +712,7 @@ static int mei_close_hdcp_session(struct mei_cl_device 
*cldev,
return 0;
 }
 
-static __attribute__((unused))
-struct i915_hdcp_component_ops mei_hdcp_ops = {
+static struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
.initiate_hdcp2_session = mei_initiate_hdcp2_session,
.verify_receiver_cert_prepare_km=
@@ -728,20 +730,78 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
.close_hdcp_session = mei_close_hdcp_session,
 };
 
+static int mei_hdcp_component_bind(struct device *mei_kdev,
+  struct device *i915_kdev, void *data)
+{
+   struct i915_component_master *comp = data;
+
+   dev_info(mei_kdev, "MEI HDCP comp bind\n");
+   WARN_ON(comp->hdcp_ops);
+
+   comp->hdcp_ops = &mei_hdcp_ops;
+   comp->i915_kdev = i915_kdev;
+   comp->mei_cldev = to_mei_cl_device(mei_kdev);
+
+   return 0;
+}
+
+static void mei_hdcp_component_unbind(struct device *mei_kdev,
+ struct device *i915_kdev, void *data)
+{
+   struct i915_component_master *comp = data;
+
+   dev_info(mei_kdev, "MEI HDCP comp unbind\n");
+   comp->hdcp_ops = NULL;
+   comp->mei_cldev = NULL;
+}
+
+static const struct component_ops mei_hdcp_component_bind_ops = {
+   .bind   = mei_hdcp_component_bind,
+   .unbind = mei_hdcp_component_unbind,
+};
+
+static void mei_hdcp_component_init(struct device *dev)
+{
+   int ret;
+
+   dev_err(dev, "MEI HDCP comp init\n");
+   ret = component_add(dev, &mei_hdcp_component_bind_ops);
+   if (ret < 0) {
+   dev_err(dev, "Failed to add MEI HDCP comp (%d)\n", ret);
+   return;
+   }
+
+   mei_hdcp_component_registered = true;
+}
+
+static void mei_hdcp_component_cleanup(struct device *dev)
+{
+   if (!mei_hdcp_component_registered)
+   return;
+
+   component_del(dev, &mei_hdcp_component_bind_ops);
+   mei_hdcp_component_registered = false;
+}
+
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
  const struct mei_cl_device_id *id)
 {
int ret;
 
ret = mei_cldev_enable(cldev);
-   if (ret < 0)
+   if (ret < 0) {
dev_err(&cldev->dev, "mei_cldev_enable Failed. %d\n", ret);
+   return ret;
+   }
+   mei_hdcp_component_init(&cldev->dev);
 
-   return ret;
+   return 0;
 }
 
 static int mei_hdcp_remove(struct mei_cl_device *cldev)
 {
+   mei_hdcp_component_cleanup(&cldev->dev);
+
return mei_cldev_disable(cldev);
 }
 
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 35/39] misc/mei/hdcp: Closing wired HDCP2.2 Tx Session

2018-09-27 Thread Ramalingam C
Request the ME to terminate the HDCP2.2 session for a port.

On Success, ME FW will mark the intel port as Deauthenticated and
terminate the wired HDCP2.2 Tx session started due to the cmd
WIRED_INITIATE_HDCP2_SESSION.

v2:
  Rebased.
v3:
  cldev is passed as first parameter [Tomas]
  Redundant comments and cast are removed [Tomas]
v4:
  %zd for ssize_t [Alexander]
  %s/return -1/return -EIO [Alexander]
  Style and typos fixed [Uma]
v5:
  Extra line is removed.
v6:
  No change.
v7:
  Collected the Rb-ed by.
  Rebased.

Signed-off-by: Ramalingam C 
Reviewed-by: Uma Shankar 
---
 drivers/misc/mei/hdcp/mei_hdcp.c | 56 +++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/mei/hdcp/mei_hdcp.c b/drivers/misc/mei/hdcp/mei_hdcp.c
index fe46bfa3e8a7..993d46b3eda7 100644
--- a/drivers/misc/mei/hdcp/mei_hdcp.c
+++ b/drivers/misc/mei/hdcp/mei_hdcp.c
@@ -655,6 +655,60 @@ static int mei_enable_hdcp_authentication(struct 
mei_cl_device *cldev,
return 0;
 }
 
+/*
+ * mei_close_hdcp_session:
+ * Function to close the Wired HDCP Tx session of ME FW.
+ * This also disables the authenticated state of the port.
+ *
+ * data: Intel HW specific Data
+ *
+ * Returns 0 on Success, <0 on Failure
+ */
+static int mei_close_hdcp_session(struct mei_cl_device *cldev,
+ struct mei_hdcp_data *data)
+{
+   struct wired_cmd_close_session_in session_close_in = { { 0 } };
+   struct wired_cmd_close_session_out session_close_out = { { 0 } };
+   struct device *dev;
+   ssize_t byte;
+
+   if (!data)
+   return -EINVAL;
+
+   dev = &cldev->dev;
+
+   session_close_in.header.api_version = HDCP_API_VERSION;
+   session_close_in.header.command_id = WIRED_CLOSE_SESSION;
+   session_close_in.header.status = ME_HDCP_STATUS_SUCCESS;
+   session_close_in.header.buffer_len =
+   WIRED_CMD_BUF_LEN_CLOSE_SESSION_IN;
+
+   session_close_in.port.integrated_port_type = data->port_type;
+   session_close_in.port.physical_port = data->port;
+
+   byte = mei_cldev_send(cldev, (u8 *)&session_close_in,
+ sizeof(session_close_in));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_send failed. %zd\n", byte);
+   return byte;
+   }
+
+   byte = mei_cldev_recv(cldev, (u8 *)&session_close_out,
+ sizeof(session_close_out));
+   if (byte < 0) {
+   dev_dbg(dev, "mei_cldev_recv failed. %zd\n", byte);
+   return byte;
+   }
+
+   if (session_close_out.header.status != ME_HDCP_STATUS_SUCCESS) {
+   dev_dbg(dev, "Session Close Failed. status: 0x%X\n",
+   session_close_out.header.status);
+   return -EIO;
+   }
+
+   return 0;
+}
+
 static __attribute__((unused))
 struct i915_hdcp_component_ops mei_hdcp_ops = {
.owner  = THIS_MODULE,
@@ -671,7 +725,7 @@ struct i915_hdcp_component_ops mei_hdcp_ops = {
.verify_mprime  = mei_verify_mprime,
.enable_hdcp_authentication =
mei_enable_hdcp_authentication,
-   .close_hdcp_session = NULL,
+   .close_hdcp_session = mei_close_hdcp_session,
 };
 
 static int mei_hdcp_probe(struct mei_cl_device *cldev,
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v7 37/39] drm/i915: Commit CP without modeset

2018-09-27 Thread Ramalingam C
Commits the content protection change of a connector,
without crtc modeset. This improves the user experience.

Originally proposed by Sean Paul at v3 of HDCP1.4 framework
https://patchwork.freedesktop.org/patch/191759/. For some
reason this was dropped, but needed for the proper functionality
of HDCP encryption.

Signed-off-by: Ramalingam C 
Suggested-by: Sean Paul 
---
 drivers/gpu/drm/i915/intel_ddi.c |  7 ---
 drivers/gpu/drm/i915/intel_display.c | 10 ++
 drivers/gpu/drm/i915/intel_drv.h |  5 +
 drivers/gpu/drm/i915/intel_hdcp.c| 32 
 4 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 7f34d3955ca1..9752dd37ad60 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3214,11 +3214,6 @@ static void intel_enable_ddi(struct intel_encoder 
*encoder,
intel_enable_ddi_hdmi(encoder, crtc_state, conn_state);
else
intel_enable_ddi_dp(encoder, crtc_state, conn_state);
-
-   /* Enable hdcp if it's desired */
-   if (conn_state->content_protection ==
-   DRM_MODE_CONTENT_PROTECTION_DESIRED)
-   intel_hdcp_enable(to_intel_connector(conn_state->connector));
 }
 
 static void intel_disable_ddi_dp(struct intel_encoder *encoder,
@@ -3258,8 +3253,6 @@ static void intel_disable_ddi(struct intel_encoder 
*encoder,
  const struct intel_crtc_state *old_crtc_state,
  const struct drm_connector_state *old_conn_state)
 {
-   intel_hdcp_disable(to_intel_connector(old_conn_state->connector));
-
if (intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_HDMI))
intel_disable_ddi_hdmi(encoder, old_crtc_state, old_conn_state);
else
diff --git a/drivers/gpu/drm/i915/intel_display.c 
b/drivers/gpu/drm/i915/intel_display.c
index 41a7b10f73dd..720b80a737f8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -12681,6 +12681,8 @@ static void intel_atomic_commit_tail(struct 
drm_atomic_state *state)
struct drm_i915_private *dev_priv = to_i915(dev);
struct drm_crtc_state *old_crtc_state, *new_crtc_state;
struct intel_crtc_state *new_intel_crtc_state, *old_intel_crtc_state;
+   struct drm_connector_state *old_conn_state, *new_conn_state;
+   struct drm_connector *connector;
struct drm_crtc *crtc;
struct intel_crtc *intel_crtc;
u64 put_domains[I915_MAX_PIPES] = {};
@@ -12779,9 +12781,17 @@ static void intel_atomic_commit_tail(struct 
drm_atomic_state *state)
}
}
 
+   for_each_oldnew_connector_in_state(state, connector, old_conn_state,
+  new_conn_state, i)
+   intel_hdcp_atomic_pre_commit(connector, old_conn_state,
+new_conn_state);
+
/* Now enable the clocks, plane, pipe, and connectors that we set up. */
dev_priv->display.update_crtcs(state);
 
+   for_each_new_connector_in_state(state, connector, new_conn_state, i)
+   intel_hdcp_atomic_commit(connector, new_conn_state);
+
/* FIXME: We should call drm_atomic_helper_commit_hw_done() here
 * already, but still need the state for the delayed optimization. To
 * fix this:
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f688bfacaa99..c3088ca7b936 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -2003,6 +2003,11 @@ static inline void 
intel_backlight_device_unregister(struct intel_connector *con
 void intel_hdcp_atomic_check(struct drm_connector *connector,
 struct drm_connector_state *old_state,
 struct drm_connector_state *new_state);
+void intel_hdcp_atomic_pre_commit(struct drm_connector *connector,
+ struct drm_connector_state *old_state,
+ struct drm_connector_state *new_state);
+void intel_hdcp_atomic_commit(struct drm_connector *connector,
+ struct drm_connector_state *new_state);
 int intel_hdcp_init(struct intel_connector *connector,
const struct intel_hdcp_shim *hdcp_shim,
bool hdcp2_supported);
diff --git a/drivers/gpu/drm/i915/intel_hdcp.c 
b/drivers/gpu/drm/i915/intel_hdcp.c
index 1f8550a03030..715649141206 100644
--- a/drivers/gpu/drm/i915/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/intel_hdcp.c
@@ -1792,7 +1792,6 @@ void intel_hdcp_atomic_check(struct drm_connector 
*connector,
 {
uint64_t old_cp = old_state->content_protection;
uint64_t new_cp = new_state->content_protection;
-   struct drm_crtc_state *crtc_state;
 
if (!new_state->crtc) {
/*
@@ -1813,10 +1812,35 @@ void inte

[PATCH v7 39/39] FOR_TEST: misc/Kconfig: Enabling mei_hdcp by default

2018-09-27 Thread Ramalingam C
FOR TESTING PURPOSE ONLY.

Enabled the mei support for HDCP2.2. This patch is created to test
the interface between I915 and MEI_HDCP.

Signed-off-by: Ramalingam C 
---
 drivers/misc/mei/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig
index 9c518b7f0011..90ed55210447 100644
--- a/drivers/misc/mei/Kconfig
+++ b/drivers/misc/mei/Kconfig
@@ -48,5 +48,6 @@ config INTEL_MEI_HDCP
tristate "Intel HDCP2.2 services of ME Interface"
select INTEL_MEI_ME
depends on DRM_I915
+   default y
help
  MEI Support for HDCP2.2 Services on Intel SoCs.
-- 
2.7.4

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/etnaviv: fix build error due to change in scheduler struct

2018-09-27 Thread Lucas Stach
Am Donnerstag, den 27.09.2018, 08:27 +0200 schrieb Nayan Deshmukh:
> The work_tdr field was moved from drm_sched_job to drm_gpu_scheduler
> as part of a previous patch.
> 
> Fixes: 4f07d88d8534 drm/scheduler: remove timeout work_struct from 
> drm_sched_job
> Signed-off-by: Nayan Deshmukh 

Thanks, I guess whoever picked up the patch that gets fixed by this
will pick this into the same tree. Did you also check VC5? I think they
gained a similar timeout extension mechanism.

Acked-by: Lucas Stach 

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c 
> b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> index 69e9b431bf1f..e7c3ed6c9a2e 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> @@ -105,7 +105,7 @@ static void etnaviv_sched_timedout_job(struct 
> drm_sched_job *sched_job)
>   change = dma_addr - gpu->hangcheck_dma_addr;
>   if (change < 0 || change > 16) {
>   gpu->hangcheck_dma_addr = dma_addr;
> - schedule_delayed_work(&sched_job->work_tdr,
> + schedule_delayed_work(&sched_job->sched->work_tdr,
> sched_job->sched->timeout);
>   return;
>   }

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/etnaviv: fix build error due to change in scheduler struct

2018-09-27 Thread Nayan Deshmukh
On Thu, Sep 27, 2018, 9:03 AM Lucas Stach  wrote:

> Am Donnerstag, den 27.09.2018, 08:27 +0200 schrieb Nayan Deshmukh:
> > The work_tdr field was moved from drm_sched_job to drm_gpu_scheduler
> > as part of a previous patch.
> >
> > Fixes: 4f07d88d8534 drm/scheduler: remove timeout work_struct from
> drm_sched_job
> > Signed-off-by: Nayan Deshmukh 
>
> Thanks, I guess whoever picked up the patch that gets fixed by this
> will pick this into the same tree. Did you also check VC5? I think they
> gained a similar timeout extension mechanism.
>
Thanks. I will have a look at VC5.

Nayan

>
> Acked-by: Lucas Stach 
>
> > ---
> >  drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> > index 69e9b431bf1f..e7c3ed6c9a2e 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> > @@ -105,7 +105,7 @@ static void etnaviv_sched_timedout_job(struct
> drm_sched_job *sched_job)
> >   change = dma_addr - gpu->hangcheck_dma_addr;
> >   if (change < 0 || change > 16) {
> >   gpu->hangcheck_dma_addr = dma_addr;
> > - schedule_delayed_work(&sched_job->work_tdr,
> > + schedule_delayed_work(&sched_job->sched->work_tdr,
> > sched_job->sched->timeout);
> >   return;
> >   }
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 2/4] drm/virtio: Handle context ID allocation errors

2018-09-27 Thread Matthew Wilcox
It is possible to run out of memory while allocating IDs.  The current
code would create a context with an invalid ID; change it to return
-ENOMEM to userspace.

Signed-off-by: Matthew Wilcox 
---
 drivers/gpu/drm/virtio/virtgpu_kms.c | 29 +++-
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c 
b/drivers/gpu/drm/virtio/virtgpu_kms.c
index e2604fe1b4ae..bf609dcae224 100644
--- a/drivers/gpu/drm/virtio/virtgpu_kms.c
+++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
@@ -52,31 +52,22 @@ static void virtio_gpu_config_changed_work_func(struct 
work_struct *work)
  events_clear, &events_clear);
 }
 
-static void virtio_gpu_ctx_id_get(struct virtio_gpu_device *vgdev,
- uint32_t *resid)
+static int virtio_gpu_context_create(struct virtio_gpu_device *vgdev,
+ uint32_t nlen, const char *name)
 {
int handle = ida_alloc_min(&vgdev->ctx_id_ida, 1, GFP_KERNEL);
-   *resid = handle;
-}
 
-static void virtio_gpu_ctx_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
-{
-   ida_free(&vgdev->ctx_id_ida, id);
-}
-
-static void virtio_gpu_context_create(struct virtio_gpu_device *vgdev,
- uint32_t nlen, const char *name,
- uint32_t *ctx_id)
-{
-   virtio_gpu_ctx_id_get(vgdev, ctx_id);
-   virtio_gpu_cmd_context_create(vgdev, *ctx_id, nlen, name);
+   if (handle < 0)
+   return handle;
+   virtio_gpu_cmd_context_create(vgdev, handle, nlen, name);
+   return handle;
 }
 
 static void virtio_gpu_context_destroy(struct virtio_gpu_device *vgdev,
  uint32_t ctx_id)
 {
virtio_gpu_cmd_context_destroy(vgdev, ctx_id);
-   virtio_gpu_ctx_id_put(vgdev, ctx_id);
+   ida_free(&vgdev->ctx_id_ida, ctx_id);
 }
 
 static void virtio_gpu_init_vq(struct virtio_gpu_queue *vgvq,
@@ -261,7 +252,7 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct 
drm_file *file)
 {
struct virtio_gpu_device *vgdev = dev->dev_private;
struct virtio_gpu_fpriv *vfpriv;
-   uint32_t id;
+   int id;
char dbgname[TASK_COMM_LEN];
 
/* can't create contexts without 3d renderer */
@@ -274,7 +265,9 @@ int virtio_gpu_driver_open(struct drm_device *dev, struct 
drm_file *file)
return -ENOMEM;
 
get_task_comm(dbgname, current);
-   virtio_gpu_context_create(vgdev, strlen(dbgname), dbgname, &id);
+   id = virtio_gpu_context_create(vgdev, strlen(dbgname), dbgname);
+   if (id < 0)
+   return id;
 
vfpriv->ctx_id = id;
file->driver_priv = vfpriv;
-- 
2.19.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] pci: Add a few new IDs for Intel GPU "spurious interrupt" quirk

2018-09-27 Thread Bin Meng
Hi Bjorn,

On Thu, Sep 27, 2018 at 12:57 AM Bjorn Helgaas  wrote:
>
> [+cc Intel DRM maintainers, etc]
>
> On Wed, Sep 26, 2018 at 08:14:01AM -0700, Bin Meng wrote:
> > Add more PCI IDs to the Intel GPU "spurious interrupt" quirk table,
> > which are known to break.
>
> Do you have a reference for this?  Any public bug reports, bugzilla,
> Intel spec reference or errata?  "Which are known to break" is pretty
> vague.
>

Sorry I used wrong words and should have been clearer. These devices
are validated to be broken. The test I used is very simple, just
unplug the VGA cable and plug it again, and "spurious interrupt" will
be seen on the interrupt line of the IGD device. I was not aware of
any public bugs filed to Intel, nor seen any errata from Intel.

> > See commit f67fd55fa96f ("PCI: Add quirk for still enabled interrupts
> > on Intel Sandy Bridge GPUs"), and commit 7c82126a94e6 ("PCI: Add new
> > ID for Intel GPU "spurious interrupt" quirk") for some history.
> >
> > Based on current findings, it is highly possible that all Intel
> > 1st/2nd/3rd generation Core processors' IGD has such quirk.
>
> Can you include a reference to these "current findings"?  I assume you
> have bug reports that include the device IDs you're adding?  If not,
> how did you build this list of new IDs?
>

By "current findings" I mean given the IDs we have here, plus previous
one added by Thomas, it's highly possible this VGA BIOS bug exists in
every 1st/2nd/3rd generation Core processors.

> The function comment added by f67fd55fa96f ("PCI: Add quirk for still
> enabled interrupts on Intel Sandy Bridge GPUs") suggests that this is
> actually a BIOS issue, not a hardware erratum, i.e., I don't see
> anything there that suggests a hardware defect.
>
> But there must be a hole somewhere -- the kernel can't be expected to
> disable interrupts in device-specific ways when there's no driver
> loaded.  Maybe it's simply a BIOS defect or maybe there's some
> interrupt or _PRT-related setup we're missing.
>

It's a pure VGA BIOS bug, not the BIOS bug or _PRT etc. The VGA BIOS
forgot to turn off the interrupt on these devices.

> > Signed-off-by: Bin Meng 
> > Cc:  # v3.4+
> > ---
> >
> >  drivers/pci/quirks.c | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> > index 6bc27b7..c0673a7 100644
> > --- a/drivers/pci/quirks.c
> > +++ b/drivers/pci/quirks.c
> > @@ -3190,7 +3190,11 @@ static void disable_igfx_irq(struct pci_dev *dev)
> >
> >   pci_iounmap(dev, regs);
> >  }
> > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0042, disable_igfx_irq);
> > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0046, disable_igfx_irq);
> > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x004a, disable_igfx_irq);
> >  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0102, disable_igfx_irq);
> > +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0106, disable_igfx_irq);
> >  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x010a, disable_igfx_irq);
> >  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x0152, disable_igfx_irq);
> >
> > --

Regards,
Bin
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] i2c: of: Try to find an I2C adapter matching the parent

2018-09-27 Thread Vlado Plaga
Tested-by: Vlado Plaga 

This patch works for me - without it my screen stays black (Acer CB5-311).

On 25/09/2018 18:06, Thierry Reding wrote:
> From: Thierry Reding 
>
> If an I2C adapter doesn't match the provided device tree node, also try
> matching the parent's device tree node. This allows finding an adapter
> based on the device node of the parent device that was used to register
> it.
>
> Signed-off-by: Thierry Reding 
[...]
>  drivers/i2c/i2c-core-of.c | 11 +++
>  1 file changed, 11 insertions(+)
>
> diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c
> index 6cb7ad608bcd..37d34885ea2d 100644
> --- a/drivers/i2c/i2c-core-of.c
> +++ b/drivers/i2c/i2c-core-of.c
> @@ -121,6 +121,14 @@ static int of_dev_node_match(struct device *dev, void 
> *data)
>   return dev->of_node == data;
>  }
>  
> +static int of_parent_node_match(struct device *dev, void *data)
> +{
> + if (dev->parent)
> + return dev->parent->of_node == data;
> +
> + return 0;
> +}
> +
>  /* must call put_device() when done with returned i2c_client device */
>  struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
>  {
> @@ -146,6 +154,9 @@ struct i2c_adapter *of_find_i2c_adapter_by_node(struct 
> device_node *node)
>   struct i2c_adapter *adapter;
>  
>   dev = bus_find_device(&i2c_bus_type, NULL, node, of_dev_node_match);
> + if (!dev)
> + dev = bus_find_device(&i2c_bus_type, NULL, node, 
> of_parent_node_match);
> +
>   if (!dev)
>   return NULL;
>  

-- 

Vlado Plaga
http://vlado-do.de/
akualisiert: 2018-05-08

"Wer das Geld hat, hat die Macht und wer die Macht hat, hat das Recht"
aus 'Der Kampf geht weiter', Rio Reiser und R.P.S. Lanrue, 1971

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 2/7] include: add setbits32/clrbits32/clrsetbits32/setbits64/clrbits64/clrsetbits64 in linux/setbits.h

2018-09-27 Thread LABBE Corentin
On Tue, Sep 25, 2018 at 07:05:00AM +0200, Christophe LEROY wrote:
> 
> 
> Le 24/09/2018 à 21:04, Corentin Labbe a écrit :
> > This patch adds setbits32/clrbits32/clrsetbits32 and
> > setbits64/clrbits64/clrsetbits64 in linux/setbits.h header.
> 
> Fix the patch subject and description.
> 
> > 
> > Signed-off-by: Corentin Labbe 
> > ---
> >   include/linux/setbits.h | 88 
> > +
> >   1 file changed, 88 insertions(+)
> >   create mode 100644 include/linux/setbits.h
> > 
> > diff --git a/include/linux/setbits.h b/include/linux/setbits.h
> > new file mode 100644
> > index ..6e7e257134ae
> > --- /dev/null
> > +++ b/include/linux/setbits.h
> > @@ -0,0 +1,88 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +#ifndef __LINUX_SETBITS_H
> > +#define __LINUX_SETBITS_H
> > +
> > +#include 
> > +
> > +#define __setbits(readfunction, writefunction, addr, set) \
> > +   writefunction((readfunction(addr) | (set)), addr)
> 
> You don't need so long names for parameters in a 2 lines macro (See 
> Linux Kernel Codying style §4 Naming).
> 
> A single line macro would be feasible with only 3 chars names:
> 
> #define __setbits(rfn, wfn, addr, set) wfn((rfn(addr) | (set)), addr)
> 

Thanks I will fix all reported problem.

> > +#define __clrbits(readfunction, writefunction, addr, mask) \
> > +   writefunction((readfunction(addr) & ~(mask)), addr)
> > +#define __clrsetbits(readfunction, writefunction, addr, mask, set) \
> > +   writefunction(((readfunction(addr) & ~(mask)) | (set)), addr)
> > +#define __setclrbits(readfunction, writefunction, addr, mask, set) \
> > +   writefunction(((readfunction(addr) | (set)) & ~(mask)), addr)
> > +
> > +#ifndef setbits_le32
> > +#define setbits_le32(addr, set) __setbits(readl, writel, addr, set)
> > +#endif
> > +#ifndef setbits_le32_relaxed
> > +#define setbits_le32_relaxed(addr, set) __setbits(readl_relaxed, 
> > writel_relaxed, \
> > +  addr, set)
> > +#endif
> > +
> > +#ifndef clrbits_le32
> > +#define clrbits_le32(addr, mask) __clrbits(readl, writel, addr, mask)
> > +#endif
> > +#ifndef clrbits_le32_relaxed
> > +#define clrbits_le32_relaxed(addr, mask) __clrbits(readl_relaxed, 
> > writel_relaxed, \
> > +   addr, mask)
> > +#endif
> > +
> > +#ifndef clrsetbits_le32
> > +#define clrsetbits_le32(addr, mask, set) __clrsetbits(readl, writel, addr, 
> > mask, set)
> > +#endif
> > +#ifndef clrsetbits_le32_relaxed
> > +#define clrsetbits_le32_relaxed(addr, mask, set) 
> > __clrsetbits(readl_relaxed, \
> > +  writel_relaxed, \
> > +  addr, mask, set)
> > +#endif
> > +
> > +#ifndef setclrbits_le32
> > +#define setclrbits_le32(addr, mask, set) __setclrbits(readl, writel, addr, 
> > mask, set)
> > +#endif
> > +#ifndef setclrbits_le32_relaxed
> > +#define setclrbits_le32_relaxed(addr, mask, set) 
> > __setclrbits(readl_relaxed, \
> > +  writel_relaxed, \
> > +  addr, mask, set)
> > +#endif
> > +
> > +/* We cannot use CONFIG_64BIT as some x86 drivers use non-atomicwriteq() */
> > +#if defined(writeq) && defined(readq)
> 
> Take care. At least Alpha Arch defines it as a static inline without
> redefining it as a #define. (see arch/alpha/kernel/io.c)

In fact, it does in arch/alpha/include/asm/io.h along with a gentle comment.
But fixing their comment will be another interesting patch serie.

Regards
Corentin Labbe
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 3/4] drm/virtio: Handle object ID allocation errors

2018-09-27 Thread Matthew Wilcox
It is possible to run out of memory while allocating IDs.  The current
code would create an object with an invalid ID; change it to return
-ENOMEM to the caller.

Signed-off-by: Matthew Wilcox 
---
 drivers/gpu/drm/virtio/virtgpu_drv.h   |  3 +--
 drivers/gpu/drm/virtio/virtgpu_fb.c| 10 --
 drivers/gpu/drm/virtio/virtgpu_gem.c   | 10 --
 drivers/gpu/drm/virtio/virtgpu_ioctl.c |  5 -
 drivers/gpu/drm/virtio/virtgpu_vq.c|  6 ++
 5 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h 
b/drivers/gpu/drm/virtio/virtgpu_drv.h
index c4468a4e454e..0a3392f2cda3 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -247,8 +247,7 @@ int virtio_gpu_surface_dirty(struct virtio_gpu_framebuffer 
*qfb,
 /* virtio vg */
 int virtio_gpu_alloc_vbufs(struct virtio_gpu_device *vgdev);
 void virtio_gpu_free_vbufs(struct virtio_gpu_device *vgdev);
-void virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev,
-  uint32_t *resid);
+int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev);
 void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id);
 void virtio_gpu_cmd_create_resource(struct virtio_gpu_device *vgdev,
uint32_t resource_id,
diff --git a/drivers/gpu/drm/virtio/virtgpu_fb.c 
b/drivers/gpu/drm/virtio/virtgpu_fb.c
index a121b1c79522..74d815483487 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fb.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fb.c
@@ -244,14 +244,17 @@ static int virtio_gpufb_create(struct drm_fb_helper 
*helper,
if (IS_ERR(obj))
return PTR_ERR(obj);
 
-   virtio_gpu_resource_id_get(vgdev, &resid);
+   ret = virtio_gpu_resource_id_get(vgdev);
+   if (ret < 0)
+   goto err_obj_vmap;
+   resid = ret;
virtio_gpu_cmd_create_resource(vgdev, resid, format,
   mode_cmd.width, mode_cmd.height);
 
ret = virtio_gpu_vmap_fb(vgdev, obj);
if (ret) {
DRM_ERROR("failed to vmap fb %d\n", ret);
-   goto err_obj_vmap;
+   goto err_obj_id;
}
 
/* attach the object to the resource */
@@ -293,8 +296,11 @@ static int virtio_gpufb_create(struct drm_fb_helper 
*helper,
 err_fb_alloc:
virtio_gpu_cmd_resource_inval_backing(vgdev, resid);
 err_obj_attach:
+err_obj_id:
+   virtio_gpu_resource_id_put(vgdev, resid);
 err_obj_vmap:
virtio_gpu_gem_free_object(&obj->gem_base);
+
return ret;
 }
 
diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c 
b/drivers/gpu/drm/virtio/virtgpu_gem.c
index 0f2768eacaee..9e3af1ec26db 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -100,7 +100,10 @@ int virtio_gpu_mode_dumb_create(struct drm_file *file_priv,
goto fail;
 
format = virtio_gpu_translate_format(DRM_FORMAT_XRGB);
-   virtio_gpu_resource_id_get(vgdev, &resid);
+   ret = virtio_gpu_resource_id_get(vgdev);
+   if (ret < 0)
+   goto fail;
+   resid = ret;
virtio_gpu_cmd_create_resource(vgdev, resid, format,
   args->width, args->height);
 
@@ -108,13 +111,16 @@ int virtio_gpu_mode_dumb_create(struct drm_file 
*file_priv,
obj = gem_to_virtio_gpu_obj(gobj);
ret = virtio_gpu_object_attach(vgdev, obj, resid, NULL);
if (ret)
-   goto fail;
+   goto fail_id;
 
obj->dumb = true;
args->pitch = pitch;
return ret;
 
+fail_id:
+   virtio_gpu_resource_id_put(vgdev, resid);
 fail:
+   /* Shouldn't we undo virtio_gpu_gem_create()? */
return ret;
 }
 
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 7bdf6f0e58a5..eec9f09f01f0 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -244,7 +244,10 @@ static int virtio_gpu_resource_create_ioctl(struct 
drm_device *dev, void *data,
INIT_LIST_HEAD(&validate_list);
memset(&mainbuf, 0, sizeof(struct ttm_validate_buffer));
 
-   virtio_gpu_resource_id_get(vgdev, &res_id);
+   ret = virtio_gpu_resource_id_get(vgdev);
+   if (ret < 0)
+   return ret;
+   res_id = ret;
 
size = rc->size;
 
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c 
b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 58be09d2eed6..387951c971d4 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -38,11 +38,9 @@
   + MAX_INLINE_CMD_SIZE \
   + MAX_INLINE_RESP_SIZE)
 
-void virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev,
-   uint32_t *resid)
+int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev)
 {
-   int handle = ida_alloc_min(&vg

[PATCH 0/4] Improve virtio ID allocation

2018-09-27 Thread Matthew Wilcox
I noticed you were using IDRs where you could be using the more efficient
IDAs, then while fixing that I noticed the lack of error handling,
and I decided to follow that up with an efficiency improvement.

There's probably a v2 of this to follow because I couldn't figure
out how to properly handle one of the error cases ... see the comment
embedded in one of the patches.

Matthew Wilcox (4):
  drm/virtio: Replace IDRs with IDAs
  drm/virtio: Handle context ID allocation errors
  drm/virtio: Handle object ID allocation errors
  drm/virtio: Use IDAs more efficiently

 drivers/gpu/drm/virtio/virtgpu_drv.h   |  9 ++---
 drivers/gpu/drm/virtio/virtgpu_fb.c| 10 --
 drivers/gpu/drm/virtio/virtgpu_gem.c   | 10 --
 drivers/gpu/drm/virtio/virtgpu_ioctl.c |  5 ++-
 drivers/gpu/drm/virtio/virtgpu_kms.c   | 46 +-
 drivers/gpu/drm/virtio/virtgpu_vq.c| 19 ---
 6 files changed, 44 insertions(+), 55 deletions(-)

-- 
2.19.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/7] powerpc: rename setbits32/clrbits32 to setbits32_be/clrbits32_be

2018-09-27 Thread LABBE Corentin
On Tue, Sep 25, 2018 at 06:56:23AM +0200, Christophe LEROY wrote:
> Fix the patch title.
> 
> 
> Le 24/09/2018 à 21:04, Corentin Labbe a écrit :
> > Since setbits32/clrbits32 work on be32, it's better to remove ambiguity on
> > the used data type.
> > 
> > Signed-off-by: Corentin Labbe 
> > ---
> >   arch/powerpc/include/asm/fsl_lbc.h   |  2 +-
> >   arch/powerpc/include/asm/io.h|  5 +-
> >   arch/powerpc/platforms/44x/canyonlands.c |  4 +-
> >   arch/powerpc/platforms/4xx/gpio.c| 28 -
> >   arch/powerpc/platforms/512x/pdm360ng.c   |  6 +-
> >   arch/powerpc/platforms/52xx/mpc52xx_common.c |  6 +-
> >   arch/powerpc/platforms/52xx/mpc52xx_gpt.c| 10 ++--
> >   arch/powerpc/platforms/82xx/ep8248e.c|  2 +-
> >   arch/powerpc/platforms/82xx/km82xx.c |  6 +-
> >   arch/powerpc/platforms/82xx/mpc8272_ads.c| 10 ++--
> >   arch/powerpc/platforms/82xx/pq2.c|  2 +-
> >   arch/powerpc/platforms/82xx/pq2ads-pci-pic.c |  4 +-
> >   arch/powerpc/platforms/82xx/pq2fads.c| 10 ++--
> >   arch/powerpc/platforms/83xx/km83xx.c |  6 +-
> >   arch/powerpc/platforms/83xx/mpc836x_mds.c|  2 +-
> >   arch/powerpc/platforms/85xx/mpc85xx_mds.c|  2 +-
> >   arch/powerpc/platforms/85xx/mpc85xx_pm_ops.c |  4 +-
> >   arch/powerpc/platforms/85xx/mpc85xx_rdb.c|  2 +-
> >   arch/powerpc/platforms/85xx/p1022_ds.c   |  4 +-
> >   arch/powerpc/platforms/85xx/p1022_rdk.c  |  4 +-
> >   arch/powerpc/platforms/85xx/t1042rdb_diu.c   |  4 +-
> >   arch/powerpc/platforms/85xx/twr_p102x.c  |  2 +-
> >   arch/powerpc/platforms/86xx/mpc8610_hpcd.c   |  4 +-
> >   arch/powerpc/platforms/8xx/adder875.c|  2 +-
> >   arch/powerpc/platforms/8xx/m8xx_setup.c  |  4 +-
> >   arch/powerpc/platforms/8xx/mpc86xads_setup.c |  4 +-
> >   arch/powerpc/platforms/8xx/mpc885ads_setup.c | 28 -
> >   arch/powerpc/platforms/embedded6xx/flipper-pic.c |  6 +-
> >   arch/powerpc/platforms/embedded6xx/hlwd-pic.c|  8 +--
> >   arch/powerpc/platforms/embedded6xx/wii.c | 10 ++--
> >   arch/powerpc/sysdev/cpm1.c   | 26 -
> >   arch/powerpc/sysdev/cpm2.c   | 16 ++---
> >   arch/powerpc/sysdev/cpm_common.c |  4 +-
> >   arch/powerpc/sysdev/fsl_85xx_l2ctlr.c|  8 +--
> >   arch/powerpc/sysdev/fsl_lbc.c|  2 +-
> >   arch/powerpc/sysdev/fsl_pci.c|  8 +--
> >   arch/powerpc/sysdev/fsl_pmc.c|  2 +-
> >   arch/powerpc/sysdev/fsl_rcpm.c   | 74 
> > 
> >   arch/powerpc/sysdev/fsl_rio.c|  4 +-
> >   arch/powerpc/sysdev/fsl_rmu.c|  8 +--
> >   arch/powerpc/sysdev/mpic_timer.c | 12 ++--
> >   41 files changed, 178 insertions(+), 177 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/fsl_lbc.h 
> > b/arch/powerpc/include/asm/fsl_lbc.h
> > index c7240a024b96..4d6a56b48a28 100644
> > --- a/arch/powerpc/include/asm/fsl_lbc.h
> > +++ b/arch/powerpc/include/asm/fsl_lbc.h
> > @@ -276,7 +276,7 @@ static inline void fsl_upm_start_pattern(struct fsl_upm 
> > *upm, u8 pat_offset)
> >*/
> >   static inline void fsl_upm_end_pattern(struct fsl_upm *upm)
> >   {
> > -   clrbits32(upm->mxmr, MxMR_OP_RP);
> > +   clrbits_be32(upm->mxmr, MxMR_OP_RP);
> >   
> > while (in_be32(upm->mxmr) & MxMR_OP_RP)
> > cpu_relax();
> > diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> > index e0331e754568..57486a1b9992 100644
> > --- a/arch/powerpc/include/asm/io.h
> > +++ b/arch/powerpc/include/asm/io.h
> > @@ -873,8 +873,8 @@ static inline void * bus_to_virt(unsigned long address)
> >   #endif /* CONFIG_PPC32 */
> >   
> >   /* access ports */
> > -#define setbits32(_addr, _v) out_be32((_addr), in_be32(_addr) |  (_v))
> > -#define clrbits32(_addr, _v) out_be32((_addr), in_be32(_addr) & ~(_v))
> > +#define setbits_be32(_addr, _v) out_be32((_addr), in_be32(_addr) |  (_v))
> > +#define clrbits_be32(_addr, _v) out_be32((_addr), in_be32(_addr) & ~(_v))
> >   
> >   #define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) |  (_v))
> >   #define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v))
> > @@ -904,6 +904,7 @@ static inline void * bus_to_virt(unsigned long address)
> >   #define clrsetbits_le16(addr, clear, set) clrsetbits(le16, addr, clear, 
> > set)
> >   
> >   #define clrsetbits_8(addr, clear, set) clrsetbits(8, addr, clear, set)
> > +#define clrsetbits_be32(addr, clear, set) clrsetbits(be32, addr, clear, 
> > set)
> 
> This one already exists a few lines above.
> 
> >   
> >   #endif /* __KERNEL__ */
> >   
> > diff --git a/arch/powerpc/platforms/44x/canyonlands.c 
> > b/arch/powerpc/platforms/44x/canyonlands.c
> > index 157f4ce46386..6aeb4ca64d09 100644

Re: [PATCH 0/3] HiBMC driver fixes

2018-09-27 Thread John Garry

On 26/09/2018 04:00, Xinliang Liu wrote:

Thanks John, good addressing!
The root cause as you said, our hibmc previous frame buffer format
depth setting is wrong which does not pass the new format sanity
checking drm_mode_legacy_fb_format.
For this series,  Reviewed-by: Xinliang Liu 
Applied to hisilicon-drm-next.


I can't see this branch in the git associated with this driver from its 
MAINTAINERS entry (git://github.com/xin3liang/linux.git), but please 
ensure these fixes are included in 4.19


Thanks,
John



Thanks,
Xinliang

On Sun, 23 Sep 2018 at 20:32, John Garry  wrote:


This patchset fixes a couple of issues in probing the HiBMC driver, as
follows:
- fix the probe error path to not carry an error code in the pointer
- don't use invalid legacy fb bpp/depth combination

Another more trivial patch is for using the standard Huawei PCI vendor ID
instead of hard-coding it.

Tested on Huawei D05 board. I can see tux on BMC VGA console.

John Garry (3):
  drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer
pointer
  drm/hisilicon: hibmc: Don't overwrite fb helper surface depth
  drm/hisilicon: hibmc: Use HUAWEI PCI vendor ID macro

 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 2 +-
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


.




___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 08/16] drm: rcar-du: Enable configurable DPAD0 routing on Gen3

2018-09-27 Thread Ulrich Hecht

> On September 14, 2018 at 11:10 AM Laurent Pinchart 
>  wrote:
> 
> 
> All Gen3 SoCs supported so far have a fixed association between DPAD0
> and DU channels, which led to hardcoding that association when writing
> the corresponding hardware register. The D3 and E3 will break that
> mechanism as DPAD0 can be dynamically connected to either DU0 or DU1.
> 
> Make DPAD0 routing dynamic on Gen3. To ensure a valid hardware
> configuration when the DU starts without the RGB output enabled, DPAD0
> is associated at initialization time to the first DU channel that it can
> be connected to. This makes no change on Gen2 as all Gen2 SoCs can
> connected DPAD0 to DU0, which is the current implicit default value.
> 
> As the DPAD0 source is always 0 when a single source is possible on
> Gen2, we can also simplify the Gen2 code in the same function to remove
> a conditional check.
> 
> Signed-off-by: Laurent Pinchart 
> Tested-by: Jacopo Mondi 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_group.c | 17 ++---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c   | 12 
>  2 files changed, 18 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_group.c
> index 4c62841eff2f..f38703e7a10d 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
> @@ -56,8 +56,6 @@ static void rcar_du_group_setup_pins(struct rcar_du_group 
> *rgrp)
>  static void rcar_du_group_setup_defr8(struct rcar_du_group *rgrp)
>  {
>   struct rcar_du_device *rcdu = rgrp->dev;
> - unsigned int possible_crtcs =
> - rcdu->info->routes[RCAR_DU_OUTPUT_DPAD0].possible_crtcs;
>   u32 defr8 = DEFR8_CODE;
>  
>   if (rcdu->info->gen < 3) {
> @@ -69,21 +67,18 @@ static void rcar_du_group_setup_defr8(struct 
> rcar_du_group *rgrp)
>* DU instances that support it.
>*/
>   if (rgrp->index == 0) {
> - if (possible_crtcs > 1)
> - defr8 |= DEFR8_DRGBS_DU(rcdu->dpad0_source);
> + defr8 |= DEFR8_DRGBS_DU(rcdu->dpad0_source);
>   if (rgrp->dev->vspd1_sink == 2)
>   defr8 |= DEFR8_VSCS;
>   }
>   } else {
>   /*
> -  * On Gen3 VSPD routing can't be configured, but DPAD routing
> -  * needs to be set despite having a single option available.
> +  * On Gen3 VSPD routing can't be configured, and DPAD routing
> +  * is set in the group corresponding to the DPAD output (no Gen3
> +  * SoC has multiple DPAD sources belonging to separate groups).
>*/
> - unsigned int rgb_crtc = ffs(possible_crtcs) - 1;
> - struct rcar_du_crtc *crtc = &rcdu->crtcs[rgb_crtc];
> -
> - if (crtc->index / 2 == rgrp->index)
> - defr8 |= DEFR8_DRGBS_DU(crtc->index);
> + if (rgrp->index == rcdu->dpad0_source / 2)
> + defr8 |= DEFR8_DRGBS_DU(rcdu->dpad0_source);
>   }
>  
>   rcar_du_group_write(rgrp, DEFR8, defr8);
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index ed7fa3204892..bd01197700c5 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -501,6 +501,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
>   struct drm_device *dev = rcdu->ddev;
>   struct drm_encoder *encoder;
>   struct drm_fbdev_cma *fbdev;
> + unsigned int dpad0_sources;
>   unsigned int num_encoders;
>   unsigned int num_groups;
>   unsigned int swindex;
> @@ -613,6 +614,17 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
>   encoder->possible_clones = (1 << num_encoders) - 1;
>   }
>  
> + /*
> +  * Initialize the default DPAD0 source to the index of the first DU
> +  * channel that can be connected to DPAD0. The exact value doesn't
> +  * matter as it should be overwritten by mode setting for the RGB
> +  * output, but it is nonetheless required to ensure a valid initial
> +  * hardware configuration on Gen3 where DU0 can't always be connected to
> +  * DPAD0.
> +  */
> + dpad0_sources = rcdu->info->routes[RCAR_DU_OUTPUT_DPAD0].possible_crtcs;
> + rcdu->dpad0_source = ffs(dpad0_sources) - 1;
> +
>   drm_mode_config_reset(dev);
>  
>   drm_kms_helper_poll_init(dev);
> -- 

Reviewed-by: Ulrich Hecht 

CU
Uli
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 4/4] drm/virtio: Use IDAs more efficiently

2018-09-27 Thread Matthew Wilcox
0-based IDAs are more efficient than any other base.  Convert the
1-based IDAs to be 0-based.

Signed-off-by: Matthew Wilcox 
---
 drivers/gpu/drm/virtio/virtgpu_kms.c | 3 ++-
 drivers/gpu/drm/virtio/virtgpu_vq.c  | 7 +--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c 
b/drivers/gpu/drm/virtio/virtgpu_kms.c
index bf609dcae224..b576c9ef6323 100644
--- a/drivers/gpu/drm/virtio/virtgpu_kms.c
+++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
@@ -59,6 +59,7 @@ static int virtio_gpu_context_create(struct virtio_gpu_device 
*vgdev,
 
if (handle < 0)
return handle;
+   handle++;
virtio_gpu_cmd_context_create(vgdev, handle, nlen, name);
return handle;
 }
@@ -67,7 +68,7 @@ static void virtio_gpu_context_destroy(struct 
virtio_gpu_device *vgdev,
  uint32_t ctx_id)
 {
virtio_gpu_cmd_context_destroy(vgdev, ctx_id);
-   ida_free(&vgdev->ctx_id_ida, ctx_id);
+   ida_free(&vgdev->ctx_id_ida, ctx_id - 1);
 }
 
 static void virtio_gpu_init_vq(struct virtio_gpu_queue *vgvq,
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c 
b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 387951c971d4..81297fe0147d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -40,12 +40,15 @@
 
 int virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev)
 {
-   return ida_alloc_min(&vgdev->resource_ida, 1, GFP_KERNEL);
+   int handle = ida_alloc(&vgdev->resource_ida, GFP_KERNEL);
+   if (handle < 0)
+   return handle;
+   return handle + 1;
 }
 
 void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
 {
-   ida_free(&vgdev->resource_ida, id);
+   ida_free(&vgdev->resource_ida, id - 1);
 }
 
 void virtio_gpu_ctrl_ack(struct virtqueue *vq)
-- 
2.19.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH -next] drm/amdgpu: remove set but not used variable 'header'

2018-09-27 Thread YueHaibing
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c: In function 'amdgpu_ucode_init_bo':
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c:431:39: warning:
 variable 'header' set but not used [-Wunused-but-set-variable]

Signed-off-by: YueHaibing 
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 1fa8bc3..afd5cf3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -428,7 +428,6 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
uint64_t fw_offset = 0;
int i, err;
struct amdgpu_firmware_info *ucode = NULL;
-   const struct common_firmware_header *header = NULL;
 
if (!adev->firmware.fw_size) {
dev_warn(adev->dev, "No ip firmware need to load\n");
@@ -465,7 +464,6 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
for (i = 0; i < adev->firmware.max_ucodes; i++) {
ucode = &adev->firmware.ucode[i];
if (ucode->fw) {
-   header = (const struct common_firmware_header 
*)ucode->fw->data;
amdgpu_ucode_init_single_fw(adev, ucode, 
adev->firmware.fw_buf_mc + fw_offset,
adev->firmware.fw_buf_ptr + 
fw_offset);
if (i == AMDGPU_UCODE_ID_CP_MEC1 &&

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH 1/4] drm/virtio: Replace IDRs with IDAs

2018-09-27 Thread Matthew Wilcox
These IDRs were only being used to allocate unique numbers, not to look
up pointers, so they can use the more space-efficient IDA instead.

Signed-off-by: Matthew Wilcox 
---
 drivers/gpu/drm/virtio/virtgpu_drv.h |  6 ++
 drivers/gpu/drm/virtio/virtgpu_kms.c | 18 --
 drivers/gpu/drm/virtio/virtgpu_vq.c  | 12 ++--
 3 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.h 
b/drivers/gpu/drm/virtio/virtgpu_drv.h
index 65605e207bbe..c4468a4e454e 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.h
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.h
@@ -180,8 +180,7 @@ struct virtio_gpu_device {
struct kmem_cache *vbufs;
bool vqs_ready;
 
-   struct idr  resource_idr;
-   spinlock_t resource_idr_lock;
+   struct ida  resource_ida;
 
wait_queue_head_t resp_wq;
/* current display info */
@@ -190,8 +189,7 @@ struct virtio_gpu_device {
 
struct virtio_gpu_fence_driver fence_drv;
 
-   struct idr  ctx_id_idr;
-   spinlock_t ctx_id_idr_lock;
+   struct ida  ctx_id_ida;
 
bool has_virgl_3d;
 
diff --git a/drivers/gpu/drm/virtio/virtgpu_kms.c 
b/drivers/gpu/drm/virtio/virtgpu_kms.c
index 65060c08522d..e2604fe1b4ae 100644
--- a/drivers/gpu/drm/virtio/virtgpu_kms.c
+++ b/drivers/gpu/drm/virtio/virtgpu_kms.c
@@ -55,21 +55,13 @@ static void virtio_gpu_config_changed_work_func(struct 
work_struct *work)
 static void virtio_gpu_ctx_id_get(struct virtio_gpu_device *vgdev,
  uint32_t *resid)
 {
-   int handle;
-
-   idr_preload(GFP_KERNEL);
-   spin_lock(&vgdev->ctx_id_idr_lock);
-   handle = idr_alloc(&vgdev->ctx_id_idr, NULL, 1, 0, 0);
-   spin_unlock(&vgdev->ctx_id_idr_lock);
-   idr_preload_end();
+   int handle = ida_alloc_min(&vgdev->ctx_id_ida, 1, GFP_KERNEL);
*resid = handle;
 }
 
 static void virtio_gpu_ctx_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
 {
-   spin_lock(&vgdev->ctx_id_idr_lock);
-   idr_remove(&vgdev->ctx_id_idr, id);
-   spin_unlock(&vgdev->ctx_id_idr_lock);
+   ida_free(&vgdev->ctx_id_ida, id);
 }
 
 static void virtio_gpu_context_create(struct virtio_gpu_device *vgdev,
@@ -151,10 +143,8 @@ int virtio_gpu_driver_load(struct drm_device *dev, 
unsigned long flags)
vgdev->dev = dev->dev;
 
spin_lock_init(&vgdev->display_info_lock);
-   spin_lock_init(&vgdev->ctx_id_idr_lock);
-   idr_init(&vgdev->ctx_id_idr);
-   spin_lock_init(&vgdev->resource_idr_lock);
-   idr_init(&vgdev->resource_idr);
+   ida_init(&vgdev->ctx_id_ida);
+   ida_init(&vgdev->resource_ida);
init_waitqueue_head(&vgdev->resp_wq);
virtio_gpu_init_vq(&vgdev->ctrlq, virtio_gpu_dequeue_ctrl_func);
virtio_gpu_init_vq(&vgdev->cursorq, virtio_gpu_dequeue_cursor_func);
diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c 
b/drivers/gpu/drm/virtio/virtgpu_vq.c
index 020070d483d3..58be09d2eed6 100644
--- a/drivers/gpu/drm/virtio/virtgpu_vq.c
+++ b/drivers/gpu/drm/virtio/virtgpu_vq.c
@@ -41,21 +41,13 @@
 void virtio_gpu_resource_id_get(struct virtio_gpu_device *vgdev,
uint32_t *resid)
 {
-   int handle;
-
-   idr_preload(GFP_KERNEL);
-   spin_lock(&vgdev->resource_idr_lock);
-   handle = idr_alloc(&vgdev->resource_idr, NULL, 1, 0, GFP_NOWAIT);
-   spin_unlock(&vgdev->resource_idr_lock);
-   idr_preload_end();
+   int handle = ida_alloc_min(&vgdev->resource_ida, 1, GFP_KERNEL);
*resid = handle;
 }
 
 void virtio_gpu_resource_id_put(struct virtio_gpu_device *vgdev, uint32_t id)
 {
-   spin_lock(&vgdev->resource_idr_lock);
-   idr_remove(&vgdev->resource_idr, id);
-   spin_unlock(&vgdev->resource_idr_lock);
+   ida_free(&vgdev->resource_ida, id);
 }
 
 void virtio_gpu_ctrl_ack(struct virtqueue *vq)
-- 
2.19.0

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 09/16] drm: rcar-du: Cache DSYSR value to ensure known initial value

2018-09-27 Thread Ulrich Hecht

> On September 14, 2018 at 11:10 AM Laurent Pinchart 
>  wrote:
> 
> 
> DSYSR is a DU channel register that also contains group fields. It is
> thus written to by both the group and CRTC code, using read-update-write
> sequences. As the register isn't initialized explicitly at startup time,
> this can lead to invalid or otherwise unexpected values being written to
> some of the fields if they have been modified by the firmware or just
> not reset properly.
> 
> To fix this we can write a fully known value to the DSYSR register when
> turning a channel's functional clock on. However, the mix of group and
> channel fields complicate this. A simpler solution is to cache the
> register and initialize the cached value to the desired hardware
> defaults.
> 
> Signed-off-by: Laurent Pinchart 
> Tested-by: Jacopo Mondi 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c  | 16 
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.h  |  5 +
>  drivers/gpu/drm/rcar-du/rcar_du_group.c |  7 ---
>  3 files changed, 17 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index 2f8776c1ec8f..f827fccf6416 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -57,13 +57,12 @@ static void rcar_du_crtc_set(struct rcar_du_crtc *rcrtc, 
> u32 reg, u32 set)
> rcar_du_read(rcdu, rcrtc->mmio_offset + reg) | set);
>  }
>  
> -static void rcar_du_crtc_clr_set(struct rcar_du_crtc *rcrtc, u32 reg,
> -  u32 clr, u32 set)
> +void rcar_du_crtc_dsysr_clr_set(struct rcar_du_crtc *rcrtc, u32 clr, u32 set)
>  {
>   struct rcar_du_device *rcdu = rcrtc->group->dev;
> - u32 value = rcar_du_read(rcdu, rcrtc->mmio_offset + reg);
>  
> - rcar_du_write(rcdu, rcrtc->mmio_offset + reg, (value & ~clr) | set);
> + rcrtc->dsysr = (rcrtc->dsysr & ~clr) | set;
> + rcar_du_write(rcdu, rcrtc->mmio_offset + DSYSR, rcrtc->dsysr);
>  }
>  
>  /* 
> -
> @@ -576,9 +575,9 @@ static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc)
>* actively driven).
>*/
>   interlaced = rcrtc->crtc.mode.flags & DRM_MODE_FLAG_INTERLACE;
> - rcar_du_crtc_clr_set(rcrtc, DSYSR, DSYSR_TVM_MASK | DSYSR_SCM_MASK,
> -  (interlaced ? DSYSR_SCM_INT_VIDEO : 0) |
> -  DSYSR_TVM_MASTER);
> + rcar_du_crtc_dsysr_clr_set(rcrtc, DSYSR_TVM_MASK | DSYSR_SCM_MASK,
> +(interlaced ? DSYSR_SCM_INT_VIDEO : 0) |
> +DSYSR_TVM_MASTER);
>  
>   rcar_du_group_start_stop(rcrtc->group, true);
>  }
> @@ -645,7 +644,7 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
>* Select switch sync mode. This stops display operation and configures
>* the HSYNC and VSYNC signals as inputs.
>*/
> - rcar_du_crtc_clr_set(rcrtc, DSYSR, DSYSR_TVM_MASK, DSYSR_TVM_SWITCH);
> + rcar_du_crtc_dsysr_clr_set(rcrtc, DSYSR_TVM_MASK, DSYSR_TVM_SWITCH);
>  
>   rcar_du_group_start_stop(rcrtc->group, false);
>  }
> @@ -1121,6 +1120,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, 
> unsigned int swindex,
>   rcrtc->group = rgrp;
>   rcrtc->mmio_offset = mmio_offsets[hwindex];
>   rcrtc->index = hwindex;
> + rcrtc->dsysr = (rcrtc->index % 2 ? 0 : DSYSR_DRES) | DSYSR_TVM_TVSYNC;
>  
>   if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE))
>   primary = &rcrtc->vsp->planes[rcrtc->vsp_pipe].plane;
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> index 4990bbe9ba26..59ac6e7d22c9 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> @@ -30,6 +30,7 @@ struct rcar_du_vsp;
>   * @mmio_offset: offset of the CRTC registers in the DU MMIO block
>   * @index: CRTC software and hardware index
>   * @initialized: whether the CRTC has been initialized and clocks enabled
> + * @dsysr: cached value of the DSYSR register
>   * @vblank_enable: whether vblank events are enabled on this CRTC
>   * @event: event to post when the pending page flip completes
>   * @flip_wait: wait queue used to signal page flip completion
> @@ -50,6 +51,8 @@ struct rcar_du_crtc {
>   unsigned int index;
>   bool initialized;
>  
> + u32 dsysr;
> +
>   bool vblank_enable;
>   struct drm_pending_vblank_event *event;
>   wait_queue_head_t flip_wait;
> @@ -103,4 +106,6 @@ void rcar_du_crtc_route_output(struct drm_crtc *crtc,
>  enum rcar_du_output output);
>  void rcar_du_crtc_finish_page_flip(struct rcar_du_crtc *rcrtc);
>  
> +void rcar_du_crtc_dsysr_clr_set(struct rcar_du_crtc *rcrtc, u32 clr, u32 
> set);
> +
>  #endif /* __RCAR_DU_CRTC_H__ */
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c 
> b/drivers/gpu/drm/rca

Re: [PATCH 4/4] drm/virtio: Use IDAs more efficiently

2018-09-27 Thread Matthew Wilcox
On Wed, Sep 26, 2018 at 09:00:31AM -0700, Matthew Wilcox wrote:
> @@ -59,6 +59,7 @@ static int virtio_gpu_context_create(struct 
> virtio_gpu_device *vgdev,
>  
>   if (handle < 0)
>   return handle;
> + handle++;
>   virtio_gpu_cmd_context_create(vgdev, handle, nlen, name);
>   return handle;
>  }

Uh.  This line is missing.

-   int handle = ida_alloc_min(&vgdev->ctx_id_ida, 1, GFP_KERNEL);
+   int handle = ida_alloc(&vgdev->ctx_id_ida, GFP_KERNEL);

It'll be there in v2 ;-)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 07/16] drm: rcar-du: Use LVDS PLL clock as dot clock when possible

2018-09-27 Thread Ulrich Hecht

> On September 14, 2018 at 11:10 AM Laurent Pinchart 
>  wrote:
> 
> 
> On selected SoCs, the DU can use the clock output by the LVDS encoder
> PLL as its input dot clock. This feature is optional, but on the D3 and
> E3 SoC it is often the only way to obtain a precise dot clock frequency,
> as the other available clocks (CPG-generated clock and external clock)
> usually have fixed rates.
> 
> Add a DU model information field to describe which DU channels can use
> the LVDS PLL output clock as their input clock, and configure clock
> routing accordingly.
> 
> This feature is available on H2, M2-W, M2-N, D3 and E3 SoCs, with D3 and
> E3 being the primary targets. It is left disabled in this commit, and
> will be enabled per-SoC after careful testing.
> 
> At the hardware level, clock routing is configured at runtime in two
> steps, first selecting an internal dot clock between the LVDS PLL clock
> and the external DOTCLKIN clock, and then selecting between the internal
> dot clock and the CPG-generated clock. The first part requires stopping
> the whole DU group in order for the change to take effect, thus causing
> flickering on the screen. For this reason we currently hardcode the
> clock source to the LVDS PLL clock if available, and allow flicker-free
> selection of the external DOTCLKIN clock or CPG-generated clock
> otherwise. A more dynamic clock selection process can be implemented
> later if the need arises.
> 
> Signed-off-by: Laurent Pinchart 
> Tested-by: Jacopo Mondi 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c  |  8 +
>  drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  2 ++
>  drivers/gpu/drm/rcar-du/rcar_du_group.c | 64 
> +
>  3 files changed, 59 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index c89751c26f9c..2f8776c1ec8f 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -261,6 +261,14 @@ static void rcar_du_crtc_set_display_timing(struct 
> rcar_du_crtc *rcrtc)
>   rcar_du_group_write(rcrtc->group, DPLLCR, dpllcr);
>  
>   escr = ESCR_DCLKSEL_DCLKIN | div;
> + } else if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index)) {
> + /*
> +  * Use the LVDS PLL output as the dot clock when outputting to
> +  * the LVDS encoder on an SoC that supports this clock routing
> +  * option. We use the clock directly in that case, without any
> +  * additional divider.
> +  */
> + escr = ESCR_DCLKSEL_DCLKIN;
>   } else {
>   struct du_clk_params params = { .diff = (unsigned long)-1 };
>  
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> index fef9ea5c22f3..ebba9aefba6a 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -53,6 +53,7 @@ struct rcar_du_output_routing {
>   * @routes: array of CRTC to output routes, indexed by output 
> (RCAR_DU_OUTPUT_*)
>   * @num_lvds: number of internal LVDS encoders
>   * @dpll_mask: bit mask of DU channels equipped with a DPLL
> + * @lvds_clk_mask: bitmask of channels that can use the LVDS clock as dot 
> clock
>   */
>  struct rcar_du_device_info {
>   unsigned int gen;
> @@ -62,6 +63,7 @@ struct rcar_du_device_info {
>   struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX];
>   unsigned int num_lvds;
>   unsigned int dpll_mask;
> + unsigned int lvds_clk_mask;
>  };
>  
>  #define RCAR_DU_MAX_CRTCS4
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_group.c
> index ef2c177afb6d..4c62841eff2f 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
> @@ -89,6 +89,54 @@ static void rcar_du_group_setup_defr8(struct rcar_du_group 
> *rgrp)
>   rcar_du_group_write(rgrp, DEFR8, defr8);
>  }
>  
> +static void rcar_du_group_setup_didsr(struct rcar_du_group *rgrp)
> +{
> + struct rcar_du_device *rcdu = rgrp->dev;
> + struct rcar_du_crtc *rcrtc;
> + unsigned int num_crtcs = 0;
> + unsigned int i;
> + u32 didsr;
> +
> + /*
> +  * Configure input dot clock routing with a hardcoded configuration. If
> +  * the DU channel can use the LVDS encoder output clock as the dot
> +  * clock, do so. Otherwise route DU_DOTCLKINn signal to DUn.
> +  *
> +  * Each channel can then select between the dot clock configured here
> +  * and the clock provided by the CPG through the ESCR register.
> +  */
> + if (rcdu->info->gen < 3 && rgrp->index == 0) {
> + /*
> +  * On Gen2 a single register in the first group controls dot
> +  * clock selection for all channels.
> +  */
> + rcrtc = rcdu->crtcs;
> + num_crtcs = rcdu->num_crtcs;
> + } else if (rc

Re: [PATCH v2 15/16] arm64: dts: renesas: r8a77990: ebisu: Enable VGA and HDMI outputs

2018-09-27 Thread Ulrich Hecht

> On September 14, 2018 at 11:10 AM Laurent Pinchart 
>  wrote:
> 
> 
> Add the LVDS decoder, HDMI encoder, VGA encoder and HDMI and VGA
> connectors, and wire up the display-related nodes with clocks, pinmux
> and regulators.
> 
> The LVDS0 and LVDS1 encoders can use the DU_DOTCLKIN0, DU_DOTCLKIN1 and
> EXTAL externals clocks. Two of them are provided to the SoC on the Ebisu
> board, hook them up in DT.
> 
> Signed-off-by: Laurent Pinchart 
> Tested-by: Jacopo Mondi 
> ---
>  arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts | 166 
> +
>  1 file changed, 166 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts 
> b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
> index 2bc3a4884b00..772ea8843d84 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
> @@ -28,6 +28,88 @@
>   /* first 128MB is reserved for secure area. */
>   reg = <0x0 0x4800 0x0 0x3800>;
>   };
> +
> + hdmi-out {
> + compatible = "hdmi-connector";
> + type = "a";
> +
> + port {
> + hdmi_con_out: endpoint {
> + remote-endpoint = <&adv7511_out>;
> + };
> + };
> + };
> +
> + lvds-decoder {
> + compatible = "thine,thc63lvd1024";
> + vcc-supply = <®_3p3v>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + thc63lvd1024_in: endpoint {
> + remote-endpoint = <&lvds0_out>;
> + };
> + };
> +
> + port@2 {
> + reg = <2>;
> + thc63lvd1024_out: endpoint {
> + remote-endpoint = <&adv7511_in>;
> + };
> + };
> + };
> + };
> +
> + vga {
> + compatible = "vga-connector";
> +
> + port {
> + vga_in: endpoint {
> + remote-endpoint = <&adv7123_out>;
> + };
> + };
> + };
> +
> + vga-encoder {
> + compatible = "adi,adv7123";
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + adv7123_in: endpoint {
> + remote-endpoint = <&du_out_rgb>;
> + };
> + };
> + port@1 {
> + reg = <1>;
> + adv7123_out: endpoint {
> + remote-endpoint = <&vga_in>;
> + };
> + };
> + };
> + };
> +
> + reg_3p3v: regulator1 {
> + compatible = "regulator-fixed";
> + regulator-name = "fixed-3.3V";
> + regulator-min-microvolt = <330>;
> + regulator-max-microvolt = <330>;
> + regulator-boot-on;
> + regulator-always-on;
> + };
> +
> + x13_clk: x13 {
> + compatible = "fixed-clock";
> + #clock-cells = <0>;
> + clock-frequency = <7425>;
> + };
>  };
>  
>  &avb {
> @@ -47,6 +129,25 @@
>   };
>  };
>  
> +&du {
> + pinctrl-0 = <&du_pins>;
> + pinctrl-names = "default";
> + status = "okay";
> +
> + clocks = <&cpg CPG_MOD 724>,
> +  <&cpg CPG_MOD 723>,
> +  <&x13_clk>;
> + clock-names = "du.0", "du.1", "dclkin.0";
> +
> + ports {
> + port@0 {
> + endpoint {
> + remote-endpoint = <&adv7123_in>;
> + };
> + };
> + };
> +};
> +
>  &ehci0 {
>   status = "okay";
>  };
> @@ -55,6 +156,66 @@
>   clock-frequency = <4800>;
>  };
>  
> +&i2c0 {
> + status = "okay";
> +
> + hdmi-encoder@39 {
> + compatible = "adi,adv7511w";
> + reg = <0x39>;
> + interrupt-parent = <&gpio1>;
> + interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
> +
> + adi,input-depth = <8>;
> + adi,input-colorspace = "rgb";
> + adi,input-clock = "1x";
> + adi,input-style = <1>;
> + adi,input-justification = "evenly";
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> + adv7511_in: endpoint {
> + 

Re: [PATCH] drm/rcar-du: Convert drm_atomic_helper_suspend/resume()

2018-09-27 Thread Souptick Joarder
On Tue, Sep 18, 2018 at 10:05 PM Souptick Joarder  wrote:
>
> convert drm_atomic_helper_suspend/resume() to use
> drm_mode_config_helper_suspend/resume().
>
> remove suspend_state field from the rcar_du_device
> structure as it is no more required.
>
> With this conversion, also drm_fbdev_cma_set_suspend_unlocked()
> will left with no consumer. So this function can be removed.
>
> Signed-off-by: Souptick Joarder 

Laurent, any comment on this patch ??
> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c   | 18 --
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 ++---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.h |  1 -
>  include/drm/drm_fb_cma_helper.h   |  2 --
>  4 files changed, 2 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c 
> b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 47e0e2f..96efc88 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -224,21 +224,3 @@ void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma 
> *fbdev_cma)
> drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
>  }
>  EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
> -
> -/**
> - * drm_fbdev_cma_set_suspend_unlocked - wrapper around
> - *  drm_fb_helper_set_suspend_unlocked
> - * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> - * @state: desired state, zero to resume, non-zero to suspend
> - *
> - * Calls drm_fb_helper_set_suspend, which is a wrapper around
> - * fb_set_suspend implemented by fbdev core.
> - */
> -void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> -   bool state)
> -{
> -   if (fbdev_cma)
> -   drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
> -  state);
> -}
> -EXPORT_SYMBOL(drm_fbdev_cma_set_suspend_unlocked);
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 02aee6c..288220f 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -357,32 +357,15 @@ static void rcar_du_lastclose(struct drm_device *dev)
>  static int rcar_du_pm_suspend(struct device *dev)
>  {
> struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> -   struct drm_atomic_state *state;
>
> -   drm_kms_helper_poll_disable(rcdu->ddev);
> -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, true);
> -
> -   state = drm_atomic_helper_suspend(rcdu->ddev);
> -   if (IS_ERR(state)) {
> -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, false);
> -   drm_kms_helper_poll_enable(rcdu->ddev);
> -   return PTR_ERR(state);
> -   }
> -
> -   rcdu->suspend_state = state;
> -
> -   return 0;
> +   return drm_mode_config_helper_suspend(rcdu->ddev);
>  }
>
>  static int rcar_du_pm_resume(struct device *dev)
>  {
> struct rcar_du_device *rcdu = dev_get_drvdata(dev);
>
> -   drm_atomic_helper_resume(rcdu->ddev, rcdu->suspend_state);
> -   drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, false);
> -   drm_kms_helper_poll_enable(rcdu->ddev);
> -
> -   return 0;
> +   return drm_mode_config_helper_resume(rcdu->ddev);
>  }
>  #endif
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h 
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> index b3a25e8..ff25c8d 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -78,7 +78,6 @@ struct rcar_du_device {
>
> struct drm_device *ddev;
> struct drm_fbdev_cma *fbdev;
> -   struct drm_atomic_state *suspend_state;
>
> struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS];
> unsigned int num_crtcs;
> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
> index 4a65f0d..8dbbe1e 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -26,8 +26,6 @@ struct drm_fbdev_cma *drm_fbdev_cma_init(struct drm_device 
> *dev,
>
>  void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
>  void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
> -void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> -   bool state);
>
>  struct drm_gem_cma_object *drm_fb_cma_get_gem_obj(struct drm_framebuffer *fb,
> unsigned int plane);
> --
> 1.9.1
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 06/16] drm: rcar-du: Perform the initial CRTC setup from rcar_du_crtc_get()

2018-09-27 Thread Ulrich Hecht
Thank you for your patch.

> On September 14, 2018 at 11:10 AM Laurent Pinchart 
>  wrote:
> 
> 
> The rcar_du_crtc_get() function is always immediately followed by a call
> to rcar_du_crtc_setup(). Call the later from the former to simplify the
> code, and add a comment to explain how the get and put calls are
> balanced.
> 
> Signed-off-by: Laurent Pinchart 
> Tested-by: Jacopo Mondi 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 107 
> +
>  1 file changed, 56 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index 6288b9ad9e24..c89751c26f9c 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -66,39 +66,6 @@ static void rcar_du_crtc_clr_set(struct rcar_du_crtc 
> *rcrtc, u32 reg,
>   rcar_du_write(rcdu, rcrtc->mmio_offset + reg, (value & ~clr) | set);
>  }
>  
> -static int rcar_du_crtc_get(struct rcar_du_crtc *rcrtc)
> -{
> - int ret;
> -
> - ret = clk_prepare_enable(rcrtc->clock);
> - if (ret < 0)
> - return ret;
> -
> - ret = clk_prepare_enable(rcrtc->extclock);
> - if (ret < 0)
> - goto error_clock;
> -
> - ret = rcar_du_group_get(rcrtc->group);
> - if (ret < 0)
> - goto error_group;
> -
> - return 0;
> -
> -error_group:
> - clk_disable_unprepare(rcrtc->extclock);
> -error_clock:
> - clk_disable_unprepare(rcrtc->clock);
> - return ret;
> -}
> -
> -static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc)
> -{
> - rcar_du_group_put(rcrtc->group);
> -
> - clk_disable_unprepare(rcrtc->extclock);
> - clk_disable_unprepare(rcrtc->clock);
> -}
> -
>  /* 
> -
>   * Hardware Setup
>   */
> @@ -546,6 +513,51 @@ static void rcar_du_crtc_setup(struct rcar_du_crtc 
> *rcrtc)
>   drm_crtc_vblank_on(&rcrtc->crtc);
>  }
>  
> +static int rcar_du_crtc_get(struct rcar_du_crtc *rcrtc)
> +{
> + int ret;
> +
> + /*
> +  * Guard against double-get, as the function is called from both the
> +  * .atomic_enable() and .atomic_begin() handlers.
> +  */
> + if (rcrtc->initialized)
> + return 0;
> +
> + ret = clk_prepare_enable(rcrtc->clock);
> + if (ret < 0)
> + return ret;
> +
> + ret = clk_prepare_enable(rcrtc->extclock);
> + if (ret < 0)
> + goto error_clock;
> +
> + ret = rcar_du_group_get(rcrtc->group);
> + if (ret < 0)
> + goto error_group;
> +
> + rcar_du_crtc_setup(rcrtc);
> + rcrtc->initialized = true;
> +
> + return 0;
> +
> +error_group:
> + clk_disable_unprepare(rcrtc->extclock);
> +error_clock:
> + clk_disable_unprepare(rcrtc->clock);
> + return ret;
> +}
> +
> +static void rcar_du_crtc_put(struct rcar_du_crtc *rcrtc)
> +{
> + rcar_du_group_put(rcrtc->group);
> +
> + clk_disable_unprepare(rcrtc->extclock);
> + clk_disable_unprepare(rcrtc->clock);
> +
> + rcrtc->initialized = false;
> +}
> +
>  static void rcar_du_crtc_start(struct rcar_du_crtc *rcrtc)
>  {
>   bool interlaced;
> @@ -639,16 +651,7 @@ static void rcar_du_crtc_atomic_enable(struct drm_crtc 
> *crtc,
>  {
>   struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
>  
> - /*
> -  * If the CRTC has already been setup by the .atomic_begin() handler we
> -  * can skip the setup stage.
> -  */
> - if (!rcrtc->initialized) {
> - rcar_du_crtc_get(rcrtc);
> - rcar_du_crtc_setup(rcrtc);
> - rcrtc->initialized = true;
> - }
> -
> + rcar_du_crtc_get(rcrtc);
>   rcar_du_crtc_start(rcrtc);
>  }
>  
> @@ -667,7 +670,6 @@ static void rcar_du_crtc_atomic_disable(struct drm_crtc 
> *crtc,
>   }
>   spin_unlock_irq(&crtc->dev->event_lock);
>  
> - rcrtc->initialized = false;
>   rcrtc->outputs = 0;
>  }
>  
> @@ -680,14 +682,17 @@ static void rcar_du_crtc_atomic_begin(struct drm_crtc 
> *crtc,
>  
>   /*
>* If a mode set is in progress we can be called with the CRTC disabled.
> -  * We then need to first setup the CRTC in order to configure planes.
> -  * The .atomic_enable() handler will notice and skip the CRTC setup.
> +  * We thus need to first get and setup the CRTC in order to configure
> +  * planes. We must *not* put the CRTC in .atomic_flush(), as it must be
> +  * kept awake until the .atomic_enable() call that will follow. The get
> +  * operation in .atomic_enable() will in that case be a no-op, and the
> +  * CRTC will be put later in .atomic_disable().
> +  *
> +  * If a mode set is not in progress the CRTC is enabled, and the
> +  * following get call will be a no-op. There is thus no need to belance

*balance

> +  * it in .atomic_flush() either.
>*/
> - if (!rcrtc->initialized) {
> - rcar_du_crtc_get(rcrtc);
> - 

Re: [PATCH 0/3] HiBMC driver fixes

2018-09-27 Thread John Garry

On 26/09/2018 10:41, Xinliang Liu wrote:

On Wed, 26 Sep 2018 at 16:46, John Garry  wrote:


On 26/09/2018 04:00, Xinliang Liu wrote:

Thanks John, good addressing!
The root cause as you said, our hibmc previous frame buffer format
depth setting is wrong which does not pass the new format sanity
checking drm_mode_legacy_fb_format.
For this series,  Reviewed-by: Xinliang Liu 
Applied to hisilicon-drm-next.


I can't see this branch in the git associated with this driver from its
MAINTAINERS entry (git://github.com/xin3liang/linux.git), but please

Not a branch, it is a tag: drm-hisilicon-next-2018-09-26


ensure these fixes are included in 4.19


As it doesn't affect 4.19-rcx, I send a PULL for 4.20.
See mail "[GIT PULL] drm-hisilicon-next-2018-09-26"


When Chris' change goes into 4.20 - which I suspect will be before yours 
- boot-time bisect will be broken.


John





Thanks,
John



Thanks,
Xinliang

On Sun, 23 Sep 2018 at 20:32, John Garry  wrote:


This patchset fixes a couple of issues in probing the HiBMC driver, as
follows:
- fix the probe error path to not carry an error code in the pointer
- don't use invalid legacy fb bpp/depth combination

Another more trivial patch is for using the standard Huawei PCI vendor ID
instead of hard-coding it.

Tested on Huawei D05 board. I can see tux on BMC VGA console.

John Garry (3):
  drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer
pointer
  drm/hisilicon: hibmc: Don't overwrite fb helper surface depth
  drm/hisilicon: hibmc: Use HUAWEI PCI vendor ID macro

 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 2 +-
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


.






.




___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 10/16] drm: rcar-du: Don't use TV sync mode when not supported by the hardware

2018-09-27 Thread Ulrich Hecht

> On September 14, 2018 at 11:10 AM Laurent Pinchart 
>  wrote:
> 
> 
> The official way to stop the display is to clear the display enable
> (DEN) bit in the DSYSR register, but that operates at a group level and
> affects the two channels in the group. To disable channels selectively,
> the driver uses TV sync mode that stops display operation on the channel
> and turns output signals into inputs.
> 
> While TV sync mode is available in all DU models currently supported,
> the D3 and E3 DUs don't support it. We will thus need to find an
> alternative way to turn channels off.
> 
> In the meantime, condition the switch to TV sync mode to the
> availability of the feature, to avoid writing an invalid value to the
> DSYSR register. The display output will turn blank as all planes are
> disabled when stopping the CRTC.
> 
> Signed-off-by: Laurent Pinchart 
> Tested-by: Jacopo Mondi 
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c |  7 ++-
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c  | 33 ++---
>  drivers/gpu/drm/rcar-du/rcar_du_drv.h  |  1 +
>  3 files changed, 29 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index f827fccf6416..17741843cf51 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -643,8 +643,13 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
>   /*
>* Select switch sync mode. This stops display operation and configures
>* the HSYNC and VSYNC signals as inputs.
> +  *
> +  * TODO: Find another way to stop the display for DUs that don't support
> +  * TVM sync.
>*/
> - rcar_du_crtc_dsysr_clr_set(rcrtc, DSYSR_TVM_MASK, DSYSR_TVM_SWITCH);
> + if (rcar_du_has(rcrtc->group->dev, RCAR_DU_FEATURE_TVM_SYNC))
> + rcar_du_crtc_dsysr_clr_set(rcrtc, DSYSR_TVM_MASK,
> +DSYSR_TVM_SWITCH);
>  
>   rcar_du_group_start_stop(rcrtc->group, false);
>  }
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c 
> b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 0954ecd2f943..fa0d381c2d0f 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -36,7 +36,8 @@ static const struct rcar_du_device_info 
> rzg1_du_r8a7743_info = {
>   .gen = 2,
>   .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
> | RCAR_DU_FEATURE_EXT_CTRL_REGS
> -   | RCAR_DU_FEATURE_INTERLACED,
> +   | RCAR_DU_FEATURE_INTERLACED
> +   | RCAR_DU_FEATURE_TVM_SYNC,
>   .channels_mask = BIT(1) | BIT(0),
>   .routes = {
>   /*
> @@ -58,7 +59,8 @@ static const struct rcar_du_device_info 
> rzg1_du_r8a7745_info = {
>   .gen = 2,
>   .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
> | RCAR_DU_FEATURE_EXT_CTRL_REGS
> -   | RCAR_DU_FEATURE_INTERLACED,
> +   | RCAR_DU_FEATURE_INTERLACED
> +   | RCAR_DU_FEATURE_TVM_SYNC,
>   .channels_mask = BIT(1) | BIT(0),
>   .routes = {
>   /*
> @@ -77,7 +79,8 @@ static const struct rcar_du_device_info 
> rzg1_du_r8a7745_info = {
>  
>  static const struct rcar_du_device_info rcar_du_r8a7779_info = {
>   .gen = 2,
> - .features = RCAR_DU_FEATURE_INTERLACED,
> + .features = RCAR_DU_FEATURE_INTERLACED
> +   | RCAR_DU_FEATURE_TVM_SYNC,
>   .channels_mask = BIT(1) | BIT(0),
>   .routes = {
>   /*
> @@ -99,7 +102,8 @@ static const struct rcar_du_device_info 
> rcar_du_r8a7790_info = {
>   .gen = 2,
>   .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
> | RCAR_DU_FEATURE_EXT_CTRL_REGS
> -   | RCAR_DU_FEATURE_INTERLACED,
> +   | RCAR_DU_FEATURE_INTERLACED
> +   | RCAR_DU_FEATURE_TVM_SYNC,
>   .quirks = RCAR_DU_QUIRK_ALIGN_128B,
>   .channels_mask = BIT(2) | BIT(1) | BIT(0),
>   .routes = {
> @@ -128,7 +132,8 @@ static const struct rcar_du_device_info 
> rcar_du_r8a7791_info = {
>   .gen = 2,
>   .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
> | RCAR_DU_FEATURE_EXT_CTRL_REGS
> -   | RCAR_DU_FEATURE_INTERLACED,
> +   | RCAR_DU_FEATURE_INTERLACED
> +   | RCAR_DU_FEATURE_TVM_SYNC,
>   .channels_mask = BIT(1) | BIT(0),
>   .routes = {
>   /*
> @@ -151,7 +156,8 @@ static const struct rcar_du_device_info 
> rcar_du_r8a7792_info = {
>   .gen = 2,
>   .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
> | RCAR_DU_FEATURE_EXT_CTRL_REGS
> -   | RCAR_DU_FEATURE_INTERLACED,
> +   | RCAR_DU_FEATURE_INTERLACED
> +   | RCAR_DU_FEATURE_TVM_SYNC,
>   .channels_mask = BIT(1) | BIT(0),
>   .routes = {
>   /* R8A7792 has two RGB outputs. */
> @@ -170,7 +176,8 @@ static const struct rcar_du_device_info 
> rcar_du_r8a7794_info = {

[PATCH] drm: stm: implement get_scanout_position function

2018-09-27 Thread Yannick FERTRE
Reviewed-by/tested-by: yannick.fer...@st.com

 Forwarded Message 
Subject: [PATCH] drm: stm: implement get_scanout_position function
Date: Fri, 29 Jun 2018 15:01:40 +0200
From: Benjamin Gaignard 
To: yannick.fer...@st.com, philippe.co...@st.com, airl...@linux.ie
CC: dri-devel@lists.freedesktop.org, linux-ker...@vger.kernel.org,
Benjamin Gaignard , Benjamin Gaignard


Hardware allow to read the position in scanout buffer so
we can use this information to make wait of vblank more accurate.

Active area bounds (start, end, total height) have already been
computed and written in ltdc registers, read them and get the
current line position to compute vpos value.

Signed-off-by: Benjamin Gaignard 
---
   drivers/gpu/drm/stm/drv.c  |  2 ++
   drivers/gpu/drm/stm/ltdc.c | 45
+
   drivers/gpu/drm/stm/ltdc.h |  5 +
   3 files changed, 52 insertions(+)

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 8698e08313e1..ac53383350e3 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -72,6 +72,8 @@ static struct drm_driver drv_driver = {
.gem_prime_vmap = drm_gem_cma_prime_vmap,
.gem_prime_vunmap = drm_gem_cma_prime_vunmap,
.gem_prime_mmap = drm_gem_cma_prime_mmap,
+   .get_scanout_position = ltdc_crtc_scanoutpos,
+   .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
   };
static int drv_load(struct drm_device *ddev)
diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
index d997a6014d6c..05b714673042 100644
--- a/drivers/gpu/drm/stm/ltdc.c
+++ b/drivers/gpu/drm/stm/ltdc.c
@@ -148,6 +148,8 @@
   #define IER_TERRIE   BIT(2)  /* Transfer ERRor Interrupt Enable */
   #define IER_RRIE BIT(3)  /* Register Reload Interrupt enable */
   +#define CPSR_CYPOS  GENMASK(15, 0)  /* Current Y position */
+
   #define ISR_LIF  BIT(0)  /* Line Interrupt Flag */
   #define ISR_FUIF BIT(1)  /* Fifo Underrun Interrupt Flag */
   #define ISR_TERRIF   BIT(2)  /* Transfer ERRor Interrupt Flag */
@@ -622,6 +624,49 @@ static void ltdc_crtc_disable_vblank(struct
drm_crtc *crtc)
reg_clear(ldev->regs, LTDC_IER, IER_LIE);
   }
   +bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
+ bool in_vblank_irq, int *vpos, int *hpos,
+ ktime_t *stime, ktime_t *etime,
+ const struct drm_display_mode *mode)
+{
+   struct ltdc_device *ldev = ddev->dev_private;
+   int line, vactive_start, vactive_end, vtotal;
+
+   if (stime)
+   *stime = ktime_get();
+
+   /* The active area starts after vsync + front porch and ends
+* at vsync + front porc + display size.
+* The total height also include back porch.
+* We have 3 possible cases to handle:
+* - line < vactive_start: vpos = line - vactive_start and will be
+* negative
+* - vactive_start < line < vactive_end: vpos = line - vactive_start
+* and will be positive
+* - line > vactive_end: vpos = line - vtotal - vactive_start
+* and will negative
+*
+* Computation for the two first cases are identical so we can
+* simplify the code and only test if line > vactive_end
+*/
+   line = reg_read(ldev->regs, LTDC_CPSR) & CPSR_CYPOS;
+   vactive_start = reg_read(ldev->regs, LTDC_BPCR) & BPCR_AVBP;
+   vactive_end = reg_read(ldev->regs, LTDC_AWCR) & AWCR_AAH;
+   vtotal = reg_read(ldev->regs, LTDC_TWCR) & TWCR_TOTALH;
+
+   if (line > vactive_end)
+   *vpos = line - vtotal - vactive_start;
+   else
+   *vpos = line - vactive_start;
+
+   *hpos = 0;
+
+   if (etime)
+   *etime = ktime_get();
+
+   return true;
+}
+
   static const struct drm_crtc_funcs ltdc_crtc_funcs = {
.destroy = drm_crtc_cleanup,
.set_config = drm_atomic_helper_set_config,
diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
index 1e16d6afb0d2..b8c5cc41e17a 100644
--- a/drivers/gpu/drm/stm/ltdc.h
+++ b/drivers/gpu/drm/stm/ltdc.h
@@ -37,6 +37,11 @@ struct ltdc_device {
struct fps_info plane_fpsi[LTDC_MAX_LAYER];
   };
   +bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
+ bool in_vblank_irq, int *vpos, int *hpos,
+ ktime_t *stime, ktime_t *etime,
+ const struct drm_display_mode *mode);
+
   int ltdc_load(struct drm_device *ddev);
   void ltdc_unload(struct drm_device *ddev);
   -- 2.15.0
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] Revert "drm/sun4i: Remove R40 display pipeline compatibles"

2018-09-27 Thread Sean Paul
On Fri, Sep 21, 2018 at 10:27:43PM +0800, Chen-Yu Tsai wrote:
> This reverts commit 3510e7a7f91088159bfc67e8abdc9f9e77d28870.
> 
> During the 4.19 merge window for drm-misc, two patches critical to
> supporting the display pipeline on the Allwinner R40 SoC were missed.
> They were applied later but missed the merge window deadline. As a
> result 4.19-rc1 kernel would crash on the R40 when it couldn't parse
> the new device tree structure. We ended up removing support for the
> R40 display pipeline for 4.19.
> 
> Since the missing patches are already merged for 4.20, we can now
> revert the commit that removed support.
> 
> Signed-off-by: Chen-Yu Tsai 
> ---
> 
> drm-misc-fixes, which contains the patch to be reverted, should be
> merged into drm-misc-next before tihs patch is applied.
> 
> Also, checkpatch.pl is complaining that the R40 mixer compatibles are
> missing from the device tree bindings. It seems the patch adding them
> never made it in. Please apply if possible:
> 
> https://patchwork.kernel.org/patch/10485815/

Applied both of these to drm-misc-next after backmerging rc5 to pick up the fix.

Sean

> 
> Thanks
> 
> ---
>  drivers/gpu/drm/sun4i/sun4i_drv.c  |  1 +
>  drivers/gpu/drm/sun4i/sun8i_mixer.c| 24 
>  drivers/gpu/drm/sun4i/sun8i_tcon_top.c |  1 +
>  3 files changed, 26 insertions(+)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c 
> b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 9027ddde4262..1e41c3f5fd6d 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -402,6 +402,7 @@ static const struct of_device_id sun4i_drv_of_table[] = {
>   { .compatible = "allwinner,sun8i-a33-display-engine" },
>   { .compatible = "allwinner,sun8i-a83t-display-engine" },
>   { .compatible = "allwinner,sun8i-h3-display-engine" },
> + { .compatible = "allwinner,sun8i-r40-display-engine" },
>   { .compatible = "allwinner,sun8i-v3s-display-engine" },
>   { .compatible = "allwinner,sun9i-a80-display-engine" },
>   { .compatible = "allwinner,sun50i-a64-display-engine" },
> diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c 
> b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> index 091f6cf40353..8b3d02b146b7 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
> @@ -545,6 +545,22 @@ static const struct sun8i_mixer_cfg sun8i_h3_mixer0_cfg 
> = {
>   .vi_num = 1,
>  };
>  
> +static const struct sun8i_mixer_cfg sun8i_r40_mixer0_cfg = {
> + .ccsc   = 0,
> + .mod_rate   = 29700,
> + .scaler_mask= 0xf,
> + .ui_num = 3,
> + .vi_num = 1,
> +};
> +
> +static const struct sun8i_mixer_cfg sun8i_r40_mixer1_cfg = {
> + .ccsc   = 1,
> + .mod_rate   = 29700,
> + .scaler_mask= 0x3,
> + .ui_num = 1,
> + .vi_num = 1,
> +};
> +
>  static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
>   .vi_num = 2,
>   .ui_num = 1,
> @@ -582,6 +598,14 @@ static const struct of_device_id sun8i_mixer_of_table[] 
> = {
>   .compatible = "allwinner,sun8i-h3-de2-mixer-0",
>   .data = &sun8i_h3_mixer0_cfg,
>   },
> + {
> + .compatible = "allwinner,sun8i-r40-de2-mixer-0",
> + .data = &sun8i_r40_mixer0_cfg,
> + },
> + {
> + .compatible = "allwinner,sun8i-r40-de2-mixer-1",
> + .data = &sun8i_r40_mixer1_cfg,
> + },
>   {
>   .compatible = "allwinner,sun8i-v3s-de2-mixer",
>   .data = &sun8i_v3s_mixer_cfg,
> diff --git a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c 
> b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> index 9831a9fe2cf4..3040a79f298f 100644
> --- a/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> +++ b/drivers/gpu/drm/sun4i/sun8i_tcon_top.c
> @@ -252,6 +252,7 @@ static int sun8i_tcon_top_remove(struct platform_device 
> *pdev)
>  
>  /* sun4i_drv uses this list to check if a device node is a TCON TOP */
>  const struct of_device_id sun8i_tcon_top_of_table[] = {
> + { .compatible = "allwinner,sun8i-r40-tcon-top" },
>   { /* sentinel */ }
>  };
>  MODULE_DEVICE_TABLE(of, sun8i_tcon_top_of_table);
> -- 
> 2.19.0
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [GIT PULL] drm-hisilicon-next-2018-09-26

2018-09-27 Thread Xinliang Liu
On Thu, 27 Sep 2018 at 08:58, Dave Airlie  wrote:
>
> On Wed, 26 Sep 2018 at 15:58, Xinliang Liu  wrote:
> >
> > Hi Dave,
> > A few changes for 4.20. Please pull.
> > - A crash fix founded in recent linux-next from John Garry
> > - One sparse warning fix from Souptick Joarder
> > - Some xxx_unref cleanup from Thomas Zimmermann
> >
> > Thanks,
> > Xinliang
> >
> >
> > The following changes since commit 36c9c3c91128e2b892c9be0dd9ee9bd82cbe82ad:
> >
> >   Merge branch 'drm-next-4.20' of
> > git://people.freedesktop.org/~agd5f/linux into drm-next (2018-09-21
> > 09:52:53 +1000)
> >
> > are available in the git repository at:
> >
> >
> >   g...@github.com:xin3liang/linux.git tags/drm-hisilicon-next-2018-09-26
>
> Any idea why this url is on a second line with a blank line?

Dave, I may figure out why. I run the same git request-pull command on
two machines.
I see that the first machine has two blank lines between "are
available in the git repository at:" and
"g...@github.com:xin3liang/linux.git
tags/drm-hisilicon-next-2018-09-26".
Yet, another machine has one blank line.

The difference might be the git's version.
The first machine git's version is 1.9.1.
Another is 2.18.0.

Will avoid this issue use new git version in the future.

Thanks,
Xinliang



>> It's stopping scripts from picking this up for patchwork, is something
> editing the pull? can you remove it?
>
> I can process this one manually, just annoying.
>
> Dave.
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/3] HiBMC driver fixes

2018-09-27 Thread Xinliang Liu
On Wed, 26 Sep 2018 at 17:54, John Garry  wrote:
>
> On 26/09/2018 10:41, Xinliang Liu wrote:
> > On Wed, 26 Sep 2018 at 16:46, John Garry  wrote:
> >>
> >> On 26/09/2018 04:00, Xinliang Liu wrote:
> >>> Thanks John, good addressing!
> >>> The root cause as you said, our hibmc previous frame buffer format
> >>> depth setting is wrong which does not pass the new format sanity
> >>> checking drm_mode_legacy_fb_format.
> >>> For this series,  Reviewed-by: Xinliang Liu 
> >>> Applied to hisilicon-drm-next.
> >>
> >> I can't see this branch in the git associated with this driver from its
> >> MAINTAINERS entry (git://github.com/xin3liang/linux.git), but please
> > Not a branch, it is a tag: drm-hisilicon-next-2018-09-26
> >
> >> ensure these fixes are included in 4.19
> >
> > As it doesn't affect 4.19-rcx, I send a PULL for 4.20.
> > See mail "[GIT PULL] drm-hisilicon-next-2018-09-26"
>
> When Chris' change goes into 4.20 - which I suspect will be before yours
> - boot-time bisect will be broken.

Yeah, that's might be a problem.

>
> John
>
> >
> >>
> >> Thanks,
> >> John
> >>
> >>>
> >>> Thanks,
> >>> Xinliang
> >>>
> >>> On Sun, 23 Sep 2018 at 20:32, John Garry  wrote:
> 
>  This patchset fixes a couple of issues in probing the HiBMC driver, as
>  follows:
>  - fix the probe error path to not carry an error code in the pointer
>  - don't use invalid legacy fb bpp/depth combination
> 
>  Another more trivial patch is for using the standard Huawei PCI vendor ID
>  instead of hard-coding it.
> 
>  Tested on Huawei D05 board. I can see tux on BMC VGA console.
> 
>  John Garry (3):
>    drm/hisilicon: hibmc: Do not carry error code in HiBMC framebuffer
>  pointer
>    drm/hisilicon: hibmc: Don't overwrite fb helper surface depth
>    drm/hisilicon: hibmc: Use HUAWEI PCI vendor ID macro
> 
>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 2 +-
>   drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_fbdev.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
>  --
>  1.9.1
> 
>  ___
>  dri-devel mailing list
>  dri-devel@lists.freedesktop.org
>  https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >>>
> >>> .
> >>>
> >>
> >>
> >
> > .
> >
>
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/msm/A6xx: Send the right perf index value to GMU

2018-09-27 Thread Sharat Masetty
The index of the perf table was being set in the wrong bit position
in the register. With this fix, the GPU clock can be seen running at
desired frequency.

Signed-off-by: Sharat Masetty 
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 3762c8d..421456e1 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -78,7 +78,7 @@ static void __a6xx_gmu_set_freq(struct a6xx_gmu *gmu, int 
index)
gmu_write(gmu, REG_A6XX_GMU_DCVS_ACK_OPTION, 0);
 
gmu_write(gmu, REG_A6XX_GMU_DCVS_PERF_SETTING,
-   ((index << 24) & 0xff) | (3 & 0xf));
+   ((3 & 0xf) << 28) | (index & 0xff));
 
/*
 * Send an invalid index as a vote for the bus bandwidth and let the
-- 
1.9.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/etnaviv: fix build error due to change in scheduler struct

2018-09-27 Thread Christian König

Am 27.09.2018 um 09:03 schrieb Lucas Stach:

Am Donnerstag, den 27.09.2018, 08:27 +0200 schrieb Nayan Deshmukh:

The work_tdr field was moved from drm_sched_job to drm_gpu_scheduler
as part of a previous patch.

Fixes: 4f07d88d8534 drm/scheduler: remove timeout work_struct from drm_sched_job
Signed-off-by: Nayan Deshmukh 

Thanks, I guess whoever picked up the patch that gets fixed by this
will pick this into the same tree. Did you also check VC5? I think they
gained a similar timeout extension mechanism.


Thanks for pointing that out and yes there is also another reference in 
drivers/gpu/drm/v3d/v3d_sched.c.


Christian.



Acked-by: Lucas Stach 


---
  drivers/gpu/drm/etnaviv/etnaviv_sched.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c 
b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
index 69e9b431bf1f..e7c3ed6c9a2e 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
@@ -105,7 +105,7 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job 
*sched_job)
change = dma_addr - gpu->hangcheck_dma_addr;
if (change < 0 || change > 16) {
gpu->hangcheck_dma_addr = dma_addr;
-   schedule_delayed_work(&sched_job->work_tdr,
+   schedule_delayed_work(&sched_job->sched->work_tdr,
  sched_job->sched->timeout);
return;
}


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [RESEND PATCH] drm/atmel-hlcdc: Replace drm_dev_unref with drm_dev_put

2018-09-27 Thread Boris Brezillon
On Wed, 26 Sep 2018 13:35:00 +0200
Thomas Zimmermann  wrote:

> This patch unifies the naming of DRM functions for reference counting
> of struct drm_device. The resulting code is more aligned with the rest
> of the Linux kernel interfaces.
> 
> Signed-off-by: Thomas Zimmermann 

Queued to drm-misc-next.

Thanks,

Boris

> ---
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c 
> b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 843cac222e60..fedbfa333bb0 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -763,7 +763,7 @@ static int atmel_hlcdc_dc_drm_probe(struct 
> platform_device *pdev)
> 
>   ret = atmel_hlcdc_dc_load(ddev);
>   if (ret)
> - goto err_unref;
> + goto err_put;
> 
>   ret = drm_dev_register(ddev, 0);
>   if (ret)
> @@ -774,8 +774,8 @@ static int atmel_hlcdc_dc_drm_probe(struct 
> platform_device *pdev)
>  err_unload:
>   atmel_hlcdc_dc_unload(ddev);
> 
> -err_unref:
> - drm_dev_unref(ddev);
> +err_put:
> + drm_dev_put(ddev);
> 
>   return ret;
>  }
> @@ -786,7 +786,7 @@ static int atmel_hlcdc_dc_drm_remove(struct 
> platform_device *pdev)
> 
>   drm_dev_unregister(ddev);
>   atmel_hlcdc_dc_unload(ddev);
> - drm_dev_unref(ddev);
> + drm_dev_put(ddev);
> 
>   return 0;
>  }
> --
> 2.19.0
> 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/ttm, drm/vmwgfx: Move the lock- and object functionality to the vmwgfx driver

2018-09-27 Thread Christian König

Am 26.09.2018 um 21:20 schrieb Thomas Hellstrom:

No other driver is using this functionality so move it out of TTM and
into the vmwgfx driver. Update includes and remove exports.
Also annotate to remove false static analyzer lock balance warnings.

Cc: Christian König 
Signed-off-by: Thomas Hellstrom 


Reviewed-by: Christian König 


---
  drivers/gpu/drm/ttm/Makefile  |  4 ++--
  drivers/gpu/drm/vmwgfx/Makefile   |  3 ++-
  drivers/gpu/drm/{ttm => vmwgfx}/ttm_lock.c| 13 ++--
  .../ttm => drivers/gpu/drm/vmwgfx}/ttm_lock.h |  0
  drivers/gpu/drm/{ttm => vmwgfx}/ttm_object.c  | 20 +++
  .../gpu/drm/vmwgfx}/ttm_object.h  |  3 +--
  drivers/gpu/drm/vmwgfx/vmwgfx_bo.c|  2 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c   |  2 +-
  drivers/gpu/drm/vmwgfx/vmwgfx_drv.h   |  4 ++--
  drivers/gpu/drm/vmwgfx/vmwgfx_prime.c |  2 +-
  10 files changed, 15 insertions(+), 38 deletions(-)
  rename drivers/gpu/drm/{ttm => vmwgfx}/ttm_lock.c (95%)
  rename {include/drm/ttm => drivers/gpu/drm/vmwgfx}/ttm_lock.h (100%)
  rename drivers/gpu/drm/{ttm => vmwgfx}/ttm_object.c (96%)
  rename {include/drm/ttm => drivers/gpu/drm/vmwgfx}/ttm_object.h (99%)

diff --git a/drivers/gpu/drm/ttm/Makefile b/drivers/gpu/drm/ttm/Makefile
index a60e560804e0..01fc670ce7a2 100644
--- a/drivers/gpu/drm/ttm/Makefile
+++ b/drivers/gpu/drm/ttm/Makefile
@@ -4,8 +4,8 @@
  
  ttm-y := ttm_memory.o ttm_tt.o ttm_bo.o \

ttm_bo_util.o ttm_bo_vm.o ttm_module.o \
-   ttm_object.o ttm_lock.o ttm_execbuf_util.o ttm_page_alloc.o \
-   ttm_bo_manager.o ttm_page_alloc_dma.o
+   ttm_execbuf_util.o ttm_page_alloc.o ttm_bo_manager.o \
+   ttm_page_alloc_dma.o
  ttm-$(CONFIG_AGP) += ttm_agp_backend.o
  
  obj-$(CONFIG_DRM_TTM) += ttm.o

diff --git a/drivers/gpu/drm/vmwgfx/Makefile b/drivers/gpu/drm/vmwgfx/Makefile
index 09b2aa08363e..22fdc07e03ad 100644
--- a/drivers/gpu/drm/vmwgfx/Makefile
+++ b/drivers/gpu/drm/vmwgfx/Makefile
@@ -7,6 +7,7 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o 
vmwgfx_drv.o \
vmwgfx_surface.o vmwgfx_prime.o vmwgfx_mob.o vmwgfx_shader.o \
vmwgfx_cmdbuf_res.o vmwgfx_cmdbuf.o vmwgfx_stdu.o \
vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \
-   vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_blit.o
+   vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_blit.o \
+   ttm_object.o ttm_lock.o
  
  obj-$(CONFIG_DRM_VMWGFX) := vmwgfx.o

diff --git a/drivers/gpu/drm/ttm/ttm_lock.c b/drivers/gpu/drm/vmwgfx/ttm_lock.c
similarity index 95%
rename from drivers/gpu/drm/ttm/ttm_lock.c
rename to drivers/gpu/drm/vmwgfx/ttm_lock.c
index 20694b8a01ca..0d59f5a19e17 100644
--- a/drivers/gpu/drm/ttm/ttm_lock.c
+++ b/drivers/gpu/drm/vmwgfx/ttm_lock.c
@@ -29,13 +29,13 @@
   * Authors: Thomas Hellstrom 
   */
  
-#include 

  #include 
  #include 
  #include 
  #include 
  #include 
-#include 
+#include "ttm_lock.h"
+#include "ttm_object.h"
  
  #define TTM_WRITE_LOCK_PENDING(1 << 0)

  #define TTM_VT_LOCK_PENDING   (1 << 1)
@@ -52,7 +52,6 @@ void ttm_lock_init(struct ttm_lock *lock)
lock->kill_takers = false;
lock->signal = SIGKILL;
  }
-EXPORT_SYMBOL(ttm_lock_init);
  
  void ttm_read_unlock(struct ttm_lock *lock)

  {
@@ -61,7 +60,6 @@ void ttm_read_unlock(struct ttm_lock *lock)
wake_up_all(&lock->queue);
spin_unlock(&lock->lock);
  }
-EXPORT_SYMBOL(ttm_read_unlock);
  
  static bool __ttm_read_lock(struct ttm_lock *lock)

  {
@@ -92,7 +90,6 @@ int ttm_read_lock(struct ttm_lock *lock, bool interruptible)
wait_event(lock->queue, __ttm_read_lock(lock));
return ret;
  }
-EXPORT_SYMBOL(ttm_read_lock);
  
  static bool __ttm_read_trylock(struct ttm_lock *lock, bool *locked)

  {
@@ -144,7 +141,6 @@ void ttm_write_unlock(struct ttm_lock *lock)
wake_up_all(&lock->queue);
spin_unlock(&lock->lock);
  }
-EXPORT_SYMBOL(ttm_write_unlock);
  
  static bool __ttm_write_lock(struct ttm_lock *lock)

  {
@@ -185,7 +181,6 @@ int ttm_write_lock(struct ttm_lock *lock, bool 
interruptible)
  
  	return ret;

  }
-EXPORT_SYMBOL(ttm_write_lock);
  
  static int __ttm_vt_unlock(struct ttm_lock *lock)

  {
@@ -262,14 +257,12 @@ int ttm_vt_lock(struct ttm_lock *lock,
  
  	return ret;

  }
-EXPORT_SYMBOL(ttm_vt_lock);
  
  int ttm_vt_unlock(struct ttm_lock *lock)

  {
return ttm_ref_object_base_unref(lock->vt_holder,
 lock->base.hash.key, TTM_REF_USAGE);
  }
-EXPORT_SYMBOL(ttm_vt_unlock);
  
  void ttm_suspend_unlock(struct ttm_lock *lock)

  {
@@ -278,7 +271,6 @@ void ttm_suspend_unlock(struct ttm_lock *lock)
wake_up_all(&lock->queue);
spin_unlock(&lock->lock);
  }
-EXPORT_SYMBOL(ttm_suspend_unlock);
  
  static bool __ttm_suspend_lock(struct ttm_lock *lock)

  {
@@ -300,4 +292,3 @@ void ttm_suspend_lock(struct ttm_lock *lock)
  {
wait_e

[PULL] drm-misc-next

2018-09-27 Thread Sean Paul

Hi Dave,
Thanks for the backmerge, we now have sun4i R40 support in again. Also
noteworthy for this week are 3 new additions to -misc. 

This is very likely the last -misc-next pull for 4.20, but I'll see how things
go in the next ~week.


drm-misc-next-2018-09-27:
drm-misc-next for 4.20:

UAPI Changes:
- None

Cross-subsystem Changes:
- MAINTAINERS: Move udl, mxsfb, and fsl-dcu into drm-misc (Stefan, Sean)

Core Changes:
- syncobj: Check condition before returning timeout in schedule() (Chris)

Driver Changes:
- various: First wave o fdrm_fbdev_generic_setup() conversions (Noralf)
- bochs/virtio: More format byte-order improvements (Gerd)
- mxsfb: A couple fixes + add runtime pm support (Leonard)
- virtio: Add vmap support for prime objects (Ezequiel)

Cc: Stefan Agner 
Cc: Sean Paul 
Cc: Noralf Trønnes 
Cc: Gerd Hoffman 
Cc: Leonard Crestez 
Cc: Chris Wilson 
Cc: Ezequiel Garcia 

Cheers, Sean


The following changes since commit bf78296ab1cb215d0609ac6cff4e43e941e51265:

  BackMerge v4.19-rc5 into drm-next (2018-09-27 11:06:46 +1000)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-next-2018-09-27

for you to fetch changes up to c2b70ffcd34eca60013d90bd6cd56e60b07adef8:

  dt-bindings: display: sun4i-drm: Add R40 mixer compatibles (2018-09-27 
04:35:42 -0400)


drm-misc-next for 4.20:

UAPI Changes:
- None

Cross-subsystem Changes:
- MAINTAINERS: Move udl, mxsfb, and fsl-dcu into drm-misc (Stefan, Sean)

Core Changes:
- syncobj: Check condition before returning timeout in schedule() (Chris)

Driver Changes:
- various: First wave o fdrm_fbdev_generic_setup() conversions (Noralf)
- bochs/virtio: More format byte-order improvements (Gerd)
- mxsfb: A couple fixes + add runtime pm support (Leonard)
- virtio: Add vmap support for prime objects (Ezequiel)

Cc: Stefan Agner 
Cc: Sean Paul 
Cc: Noralf Trønnes 
Cc: Gerd Hoffman 
Cc: Leonard Crestez 
Cc: Chris Wilson 
Cc: Ezequiel Garcia 


Chen-Yu Tsai (1):
  Revert "drm/sun4i: Remove R40 display pipeline compatibles"

Chris Wilson (2):
  drm: Use default dma_fence hooks where possible for null syncobj
  drm: Fix syncobj handing of schedule() returning 0

Ezequiel Garcia (3):
  virtio: Add virtio_gpu_object_kunmap()
  virtio: Rework virtio_gpu_object_kmap()
  virtio: Support prime objects vmap/vunmap

Gerd Hoffmann (7):
  drm/virtio: pass virtio_gpu_object to 
virtio_gpu_cmd_transfer_to_host_{2d, 3d}
  drm: move native byte order quirk to new drm_driver_legacy_fb_format 
function
  drm: use drm_driver_legacy_fb_format in drm_gem_fbdev_fb_create
  drm/bochs: fix DRM_FORMAT_* handling for big endian machines.
  drm/bochs: support changing byteorder at mode set time
  drm/virtio: fix DRM_FORMAT_* handling
  drm: move quirk_addfb_prefer_xbgr_30bpp handling to 
drm_driver_legacy_fb_format too

Jernej Skrabec (1):
  dt-bindings: display: sun4i-drm: Add R40 mixer compatibles

José Roberto de Souza (1):
  drm: Return -EOPNOTSUPP in drm_setclientcap() when driver do not support 
KMS

Kieran Bingham (1):
  drm/atomic: Initialise planes with opaque alpha values

Leonard Crestez (5):
  drm/mxsfb: Move axi clk enable/disable to crtc enable/disable
  drm/mxsfb: Fix initial corrupt frame when activating display
  drm/mxsfb: Add pm_runtime calls to pipe_enable/disable
  drm/mxsfb: Add PM_SLEEP support
  drm/mxsfb: Switch to drm_atomic_helper_commit_tail_rpm

Noralf Trønnes (9):
  drm/fb-helper: Improve error reporting in setup
  drm/arm/hdlcd: Use drm_fbdev_generic_setup()
  drm/arm/mali: Use drm_fbdev_generic_setup()
  drm/imx: Use drm_fbdev_generic_setup()
  drm/pl111: Use drm_fbdev_generic_setup()
  drm/sti: Use drm_fbdev_generic_setup()
  drm/tve200: Use drm_fbdev_generic_setup()
  drm/vc4: Use drm_fbdev_generic_setup()
  drm/zte: Use drm_fbdev_generic_setup()

Sean Paul (3):
  MAINTAINERS: Move udl drm driver to drm-misc tree
  MAINTAINERS: Move mxsfb drm driver to drm-misc tree
  Merge drm/drm-next into drm-misc-next

Stefan Agner (1):
  MAINTAINERS: Move fsl-dcu driver to drm-misc tree

Thomas Zimmermann (3):
  drm/udl: Replace drm_dev_unref with drm_dev_put
  drm/tegra: Replace drm_dev_unref with drm_dev_put
  drm/fsl-dcu: Replace drm_dev_unref with drm_dev_put

Wei Yongjun (1):
  drm/vkms: Fix possible memory leak in _vkms_get_crc()

zhong jiang (1):
  gpu: do not double put device node in zx_drm_probe

 .../bindings/display/sunxi/sun4i-drm.txt   |  2 +
 MAINTAINERS|  7 +++
 drivers/gpu/drm/arm/hdlcd_drv.c| 11 +---
 drivers/gpu/drm/arm/malidp_drv.c   | 11 +---
 drivers/gpu/drm/bochs/bochs.h  |  4 +-
 drivers/gpu/drm/bochs/bochs_fbdev.c  

[PULL] drm-intel-next

2018-09-27 Thread Joonas Lahtinen
Hi Dave,

Here's the second and final set of changes for v4.20, tagged
last Friday before -rc5. We run it through the testing with
the CI farm machines and found no regressions.

Most user noticeable things are MythTV video stuttering
regression fix for older hardware, black screen fix on resume
when using color space corrections (CSC) and W/A for 16 GB DIMM
modules on Skylake and newer systems.

There are some further Icelake enabling patches and addition
of the DMC firmware which is required for power management,
but all still behind i915.alpha_support=1 flag.

Jani will be taking care of v4.21 as I proceed to provide
fixes for v4.20.

Regards, Joonas

PS. CI folks asked to remind you that by pushing to 'for-intel-ci'
branch in your tree, you can trigger CI runs yourself.

drm-intel-next-2018-09-21:
Driver Changes:

- Bugzilla 107600: Fix stuttering video playback on MythTV on old hardware 
(Chris)
- Avoid black screen when using CSC coefficient matrix (Raviraj)
- Hammer PDs on Baytrail to make sure they reload (Chris)
- Capture some objects if unable to capture all, on error (Chris)
- Add W/A for 16 GB DIMMs on SKL+ (Mahesh)
- Only enable IPC for symmetric memory configurations on KBL+ (Mahesh)
- Assume pipe A to have maximum stride limits (Ville)
- Always update update OA contexts via context image (Tvrtko)
- Icelake enabling patches (Madhav, Dhinakaran)
- Add Icelake DMC firmware (Anusha)
- Fixes for CI found corner cases (Chris)
- Limit the backpressure for request allocation (Chris)
- Park GPU on module load so usage starts from known state (Chris)
- Flush tasklet when checking for idle (Chris)
- Use coherent write into the context image on BSW+ (Chris)
- Fix possible integer overflow for framebuffers that get aligned past 4GiB 
(Ville)
- Downgrade fence timeout from warn to notice and add debug hint (Chris)

- Fixes to multi function encoder code (Ville)
- Fix sprite plane check logic (Dan, Ville)
- PAGE_SIZE vs. I915_GTT_PAGE_SIZE fixes (Ville)
- Decode memory bandwidth and parameters for BXT and SKL+ (Mahesh)
- Overwrite BIOS set IPC value from KMS (Mahesh)
- Multiple pipe handling code cleanups/restructurings/optimizations (Ville)
- Spare low 4G address for non-48bit objects (Chris)
- Free context_setparam of struct_mutex (Chris)
- Delay updating ring register state on resume (Chris)
- Avoid unnecessarily copying overlay IOCTL parameters (Chris)
- Update GuC power domain states even without submission (Michal)
- Restore GuC preempt-context across S3/S4 (Chris)
- Add kernel selftest for rapid context switching (Chris)
- Keep runtime power management ref for live selftests (Chris)
- GEM code cleanups (Matt)

The following changes since commit a28957b8f10be714f076fb3981a3b1a0318c48c2:

  drm/i915: Update DRIVER_DATE to 20180906 (2018-09-06 16:54:43 +0300)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-intel tags/drm-intel-next-2018-09-21

for you to fetch changes up to 448626103dad54ec5d06722e955586b5d557625d:

  drm/i915: Update DRIVER_DATE to 20180921 (2018-09-21 12:26:37 +0300)


Driver Changes:

- Bugzilla 107600: Fix stuttering video playback on MythTV on old hardware 
(Chris)
- Avoid black screen when using CSC coefficient matrix (Raviraj)
- Hammer PDs on Baytrail to make sure they reload (Chris)
- Capture some objects if unable to capture all, on error (Chris)
- Add W/A for 16 GB DIMMs on SKL+ (Mahesh)
- Only enable IPC for symmetric memory configurations on KBL+ (Mahesh)
- Assume pipe A to have maximum stride limits (Ville)
- Always update update OA contexts via context image (Tvrtko)
- Icelake enabling patches (Madhav, Dhinakaran)
- Add Icelake DMC firmware (Anusha)
- Fixes for CI found corner cases (Chris)
- Limit the backpressure for request allocation (Chris)
- Park GPU on module load so usage starts from known state (Chris)
- Flush tasklet when checking for idle (Chris)
- Use coherent write into the context image on BSW+ (Chris)
- Fix possible integer overflow for framebuffers that get aligned past 4GiB 
(Ville)
- Downgrade fence timeout from warn to notice and add debug hint (Chris)

- Fixes to multi function encoder code (Ville)
- Fix sprite plane check logic (Dan, Ville)
- PAGE_SIZE vs. I915_GTT_PAGE_SIZE fixes (Ville)
- Decode memory bandwidth and parameters for BXT and SKL+ (Mahesh)
- Overwrite BIOS set IPC value from KMS (Mahesh)
- Multiple pipe handling code cleanups/restructurings/optimizations (Ville)
- Spare low 4G address for non-48bit objects (Chris)
- Free context_setparam of struct_mutex (Chris)
- Delay updating ring register state on resume (Chris)
- Avoid unnecessarily copying overlay IOCTL parameters (Chris)
- Update GuC power domain states even without submission (Michal)
- Restore GuC preempt-context across S3/S4 (Chris)
- Add kernel selftest for rapid context switching (Chris)
- Keep runtime power management ref for live selftests (Chris)
- GEM code cleanups (Matt)

--

[PULL] drm-misc-fixes

2018-09-27 Thread Maarten Lankhorst
drm-misc-fixes-2018-09-27:
Single fix on top of v4.19-rc5.

drm-misc-fixes for v4.19-rc6:
- Don't leak fences in drm/syncobj
The following changes since commit 6bf4ca7fbc85d80446ac01c0d1d77db4d91a6d84:

  Linux 4.19-rc5 (2018-09-23 19:15:18 +0200)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-fixes-2018-09-27

for you to fetch changes up to 337fe9f5c1e7de1f391c6a692531379d2aa2ee11:

  drm/syncobj: Don't leak fences when WAIT_FOR_SUBMIT is set (2018-09-26 
10:39:14 -0400)


drm-misc-fixes for v4.19-rc6:
- Don't leak fences in drm/syncobj


Jason Ekstrand (1):
  drm/syncobj: Don't leak fences when WAIT_FOR_SUBMIT is set

 drivers/gpu/drm/drm_syncobj.c | 5 +
 1 file changed, 5 insertions(+)
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/display: Change status's type in aux_reply_transaction_data

2018-09-27 Thread Harry Wentland
On 2018-09-24 06:22 PM, Nathan Chancellor wrote:
> On Mon, Sep 24, 2018 at 03:07:16PM -0700, Nick Desaulniers wrote:
>> On Fri, Sep 21, 2018 at 2:55 PM Nathan Chancellor
>>  wrote:
>>>
>>> Clang warns when one enumerated type is implicitly converted to another.
>>>
>>> drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
>>> implicit conversion from enumeration type 'enum
>>> aux_channel_operation_result' to different enumeration type 'enum
>>> aux_transaction_reply' [-Wenum-conversion]
>>> reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
>>>   ~ ^~~
>>> drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
>>> warning: implicit conversion from enumeration type 'enum
>>> aux_channel_operation_result' to different enumeration type 'enum
>>> aux_transaction_reply' [-Wenum-conversion]
>>> reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
>>>   ~ ^~~
>>
>> I think the enum is actually wrong here.  I think the correct fix would be:
>>
>> - reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
>> + reply->status = AUX_TRANSACTION_REPLY_HPD_DISCON;
>>
>> The identifiers are so similar, my guess was that it was easy to mix
>> them up.  This looks like an actual bug to me, since the identifiers
>> have different values between the 2 different enums.
>>
> 
> Hmmm interesting... I will be happy to send a v2 with your suggestion if
> one of the maintainers could confirm that to be the case (given DRM code
> is rather dense).
> 

Nick is correct. We should keep the enum but assign 
AUX_TRANSACTION_REPLY_HPD_DISCON in dce_aux.c and aux_engine_dce110.c.

Thanks for spotting this.

Harry

> Thanks for the review!
> Nathan
> 
>>>
>>> Instead of implicitly or explicitly converting between types, just
>>> change status to type uint8_t (since its max size is 255) which avoids
>>> this construct altogether.
>>>
>>> Reported-by: Nick Desaulniers 
>>> Signed-off-by: Nathan Chancellor 
>>> ---
>>>  drivers/gpu/drm/amd/display/dc/dc_ddc_types.h | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h 
>>> b/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h
>>> index 05c8c31d8b31..97e1d4d19263 100644
>>> --- a/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h
>>> +++ b/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h
>>> @@ -79,7 +79,7 @@ enum aux_transaction_reply {
>>>  };
>>>
>>>  struct aux_reply_transaction_data {
>>> -   enum aux_transaction_reply status;
>>> +   uint8_t status;
>>> uint32_t length;
>>> uint8_t *data;
>>>  };
>>> --
>>> 2.19.0
>>>
>>
>>
>> -- 
>> Thanks,
>> ~Nick Desaulniers
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/rockchip: vop: add rk3188 hs_start interrupt as dsp_hold equivalent

2018-09-27 Thread Heiko Stuebner
Am Sonntag, 23. September 2018, 14:37:30 CEST schrieb Heiko Stuebner:
> The hs_start interrupt on rk3188 fires at the start of a new frame, so
> serves essentially the same purpose as the dsp_hold_valid irq in checking
> when the last frame got delivered when going to standby. So define it
> to fix a hang on atomic_disable of the vop because the completion never
> really completed before.
> 
> Fixes: 428e15cc41e3 ("drm/rockchip: vop: add rk3188 vop definitions")
> Signed-off-by: Heiko Stuebner 

applied to drm-misc-next with Sandy's Review.


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] drm/v3d: fix build error due to change in scheduler struct

2018-09-27 Thread Nayan Deshmukh
The work_tdr field was moved from drm_sched_job to drm_gpu_scheduler
as part of a previous patch.

Fixes: 4f07d88d8534 drm/scheduler: remove timeout work_struct from
drm_sched_job

Signed-off-by: Nayan Deshmukh 
---
 drivers/gpu/drm/v3d/v3d_sched.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c
index a5501581d96b..9243dea6e6ad 100644
--- a/drivers/gpu/drm/v3d/v3d_sched.c
+++ b/drivers/gpu/drm/v3d/v3d_sched.c
@@ -168,7 +168,7 @@ v3d_job_timedout(struct drm_sched_job *sched_job)
job->timedout_ctca = ctca;
job->timedout_ctra = ctra;
 
-   schedule_delayed_work(&job->base.work_tdr,
+   schedule_delayed_work(&job->base.sched->work_tdr,
  job->base.sched->timeout);
return;
}
-- 
2.14.3

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/imx: fix build failure without CONFIG_DRM_FBDEV_EMULATION

2018-09-27 Thread Noralf Trønnes


Den 26.09.2018 21.38, skrev Arnd Bergmann:

The variable is declared in an #ifdef section, but the user is
now unconditional, which leads to a build failure:

drivers/gpu/drm/imx/imx-drm-core.c: In function 'imx_drm_bind':
drivers/gpu/drm/imx/imx-drm-core.c:264:6: error: 'legacyfb_depth' undeclared 
(first use in this function); did you mean 'lockdep_depth'?

Remove the remaining #ifdef as well.

Fixes: f53705fd9803 ("drm/imx: Use drm_fbdev_generic_setup()")
Signed-off-by: Arnd Bergmann 
---


Thanks for fixing my mistakes Arnd.
Applied to drm-misc-next.

Noralf.


  drivers/gpu/drm/imx/imx-drm-core.c | 2 --
  1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c 
b/drivers/gpu/drm/imx/imx-drm-core.c
index a70f3131a377..0e6942f21a4e 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -35,10 +35,8 @@
  
  #define MAX_CRTC	4
  
-#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)

  static int legacyfb_depth = 16;
  module_param(legacyfb_depth, int, 0444);
-#endif
  
  DEFINE_DRM_GEM_CMA_FOPS(imx_drm_driver_fops);
  


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: stm: implement get_scanout_position function

2018-09-27 Thread Yannick FERTRE
Reviewed-by: Yannick Fertré 
Tested-by: Yannick Fertré 

On 09/27/2018 10:15 AM, Yannick FERTRE wrote:
> Reviewed-by/tested-by: yannick.fer...@st.com
>
>  Forwarded Message 
> Subject: [PATCH] drm: stm: implement get_scanout_position function
> Date: Fri, 29 Jun 2018 15:01:40 +0200
> From: Benjamin Gaignard 
> To: yannick.fer...@st.com, philippe.co...@st.com, airl...@linux.ie
> CC: dri-devel@lists.freedesktop.org, linux-ker...@vger.kernel.org,
> Benjamin Gaignard , Benjamin Gaignard
> 
>
> Hardware allow to read the position in scanout buffer so
> we can use this information to make wait of vblank more accurate.
>
> Active area bounds (start, end, total height) have already been
> computed and written in ltdc registers, read them and get the
> current line position to compute vpos value.
>
> Signed-off-by: Benjamin Gaignard 
> ---
>   drivers/gpu/drm/stm/drv.c  |  2 ++
>   drivers/gpu/drm/stm/ltdc.c | 45
> +
>   drivers/gpu/drm/stm/ltdc.h |  5 +
>   3 files changed, 52 insertions(+)
>
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index 8698e08313e1..ac53383350e3 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -72,6 +72,8 @@ static struct drm_driver drv_driver = {
>   .gem_prime_vmap = drm_gem_cma_prime_vmap,
>   .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
>   .gem_prime_mmap = drm_gem_cma_prime_mmap,
> +    .get_scanout_position = ltdc_crtc_scanoutpos,
> +    .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
>   };
>    static int drv_load(struct drm_device *ddev)
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index d997a6014d6c..05b714673042 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -148,6 +148,8 @@
>   #define IER_TERRIE    BIT(2)    /* Transfer ERRor Interrupt 
> Enable */
>   #define IER_RRIE    BIT(3)    /* Register Reload Interrupt 
> enable */
>   +#define CPSR_CYPOS    GENMASK(15, 0)    /* Current Y position */
> +
>   #define ISR_LIF    BIT(0)    /* Line Interrupt Flag */
>   #define ISR_FUIF    BIT(1)    /* Fifo Underrun Interrupt Flag */
>   #define ISR_TERRIF    BIT(2)    /* Transfer ERRor Interrupt Flag */
> @@ -622,6 +624,49 @@ static void ltdc_crtc_disable_vblank(struct
> drm_crtc *crtc)
>   reg_clear(ldev->regs, LTDC_IER, IER_LIE);
>   }
>   +bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
> +  bool in_vblank_irq, int *vpos, int *hpos,
> +  ktime_t *stime, ktime_t *etime,
> +  const struct drm_display_mode *mode)
> +{
> +    struct ltdc_device *ldev = ddev->dev_private;
> +    int line, vactive_start, vactive_end, vtotal;
> +
> +    if (stime)
> +    *stime = ktime_get();
> +
> +    /* The active area starts after vsync + front porch and ends
> + * at vsync + front porc + display size.
> + * The total height also include back porch.
> + * We have 3 possible cases to handle:
> + * - line < vactive_start: vpos = line - vactive_start and will be
> + * negative
> + * - vactive_start < line < vactive_end: vpos = line - vactive_start
> + * and will be positive
> + * - line > vactive_end: vpos = line - vtotal - vactive_start
> + * and will negative
> + *
> + * Computation for the two first cases are identical so we can
> + * simplify the code and only test if line > vactive_end
> + */
> +    line = reg_read(ldev->regs, LTDC_CPSR) & CPSR_CYPOS;
> +    vactive_start = reg_read(ldev->regs, LTDC_BPCR) & BPCR_AVBP;
> +    vactive_end = reg_read(ldev->regs, LTDC_AWCR) & AWCR_AAH;
> +    vtotal = reg_read(ldev->regs, LTDC_TWCR) & TWCR_TOTALH;
> +
> +    if (line > vactive_end)
> +    *vpos = line - vtotal - vactive_start;
> +    else
> +    *vpos = line - vactive_start;
> +
> +    *hpos = 0;
> +
> +    if (etime)
> +    *etime = ktime_get();
> +
> +    return true;
> +}
> +
>   static const struct drm_crtc_funcs ltdc_crtc_funcs = {
>   .destroy = drm_crtc_cleanup,
>   .set_config = drm_atomic_helper_set_config,
> diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> index 1e16d6afb0d2..b8c5cc41e17a 100644
> --- a/drivers/gpu/drm/stm/ltdc.h
> +++ b/drivers/gpu/drm/stm/ltdc.h
> @@ -37,6 +37,11 @@ struct ltdc_device {
>   struct fps_info plane_fpsi[LTDC_MAX_LAYER];
>   };
>   +bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
> +  bool in_vblank_irq, int *vpos, int *hpos,
> +  ktime_t *stime, ktime_t *etime,
> +  const struct drm_display_mode *mode);
> +
>   int ltdc_load(struct drm_device *ddev);
>   void ltdc_unload(struct drm_device *ddev);
>   -- 2.15.0
>

-- 
Yannick Fertré | TINA: 166 7152 | Tel: +33 244027152 | Mobile: +33 620600270
Microcontrollers and Digital ICs Group | Microcontrolleurs Division
___
dri-devel 

Re: [PATCH 14/20] drm/stm: Use drm_fbdev_generic_setup()

2018-09-27 Thread Yannick FERTRE
Hi Noralf,
many thanks for your patch.

Acked-by: Yannick Fertré 


On 09/08/2018 03:46 PM, Noralf Trønnes wrote:
> The CMA helper is already using the drm_fb_helper_generic_probe part of
> the generic fbdev emulation. This patch makes full use of the generic
> fbdev emulation by using its drm_client callbacks. This means that
> drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
> now handled by the emulation code. Additionally fbdev unregister happens
> automatically on drm_dev_unregister().
>
> The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
> driver. This is done to highlight the fact that fbdev emulation is an
> internal client that makes use of the driver, it is not part of the
> driver as such. If fbdev setup fails, an error is printed, but the driver
> succeeds probing.
>
> drm_fbdev_generic_setup() handles mode_config.num_connector being zero.
> In that case it retries fbdev setup on the next .output_poll_changed.
>
> Cc: Yannick Fertre 
> Cc: Philippe Cornu 
> Cc: Benjamin Gaignard 
> Cc: Vincent Abriou 
> Signed-off-by: Noralf Trønnes 
> ---
>   drivers/gpu/drm/stm/drv.c | 11 ++-
>   1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index f2021b23554d..97eee8660014 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -26,7 +26,6 @@
>   
>   static const struct drm_mode_config_funcs drv_mode_config_funcs = {
>   .fb_create = drm_gem_fb_create,
> - .output_poll_changed = drm_fb_helper_output_poll_changed,
>   .atomic_check = drm_atomic_helper_check,
>   .atomic_commit = drm_atomic_helper_commit,
>   };
> @@ -52,7 +51,6 @@ DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops);
>   static struct drm_driver drv_driver = {
>   .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME |
>  DRIVER_ATOMIC,
> - .lastclose = drm_fb_helper_lastclose,
>   .name = "stm",
>   .desc = "STMicroelectronics SoC DRM",
>   .date = "20170330",
> @@ -108,12 +106,6 @@ static int drv_load(struct drm_device *ddev)
>   drm_mode_config_reset(ddev);
>   drm_kms_helper_poll_init(ddev);
>   
> - if (ddev->mode_config.num_connector) {
> - ret = drm_fb_cma_fbdev_init(ddev, 16, 0);
> - if (ret)
> - DRM_DEBUG("Warning: fails to create fbdev\n");
> - }
> -
>   platform_set_drvdata(pdev, ddev);
>   
>   return 0;
> @@ -126,7 +118,6 @@ static void drv_unload(struct drm_device *ddev)
>   {
>   DRM_DEBUG("%s\n", __func__);
>   
> - drm_fb_cma_fbdev_fini(ddev);
>   drm_kms_helper_poll_fini(ddev);
>   ltdc_unload(ddev);
>   drm_mode_config_cleanup(ddev);
> @@ -154,6 +145,8 @@ static int stm_drm_platform_probe(struct platform_device 
> *pdev)
>   if (ret)
>   goto err_put;
>   
> + drm_fbdev_generic_setup(ddev, 16);
> +
>   return 0;
>   
>   err_put:

-- 
Yannick Fertré | TINA: 166 7152 | Tel: +33 244027152 | Mobile: +33 620600270
Microcontrollers and Digital ICs Group | Microcontrolleurs Division
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 8/9] drm/panel: simple: fix BOE/HV070WSA-100 timings

2018-09-27 Thread Thierry Reding
On Wed, Jul 25, 2018 at 05:46:43PM +0200, Andrzej Hajda wrote:
> Panel timings were taken from vendor code and are not fully correct - refresh
> rate is about 50Hz instead of 60Hz. The patch fixes it.
> 
> Signed-off-by: Andrzej Hajda 
> ---
>  drivers/gpu/drm/panel/panel-simple.c | 14 +++---
>  1 file changed, 7 insertions(+), 7 deletions(-)

Applied, thanks.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 1/2] drm/panel: seiko-43wvf1g: Switch to SPDX identifier

2018-09-27 Thread Thierry Reding
On Thu, Jul 26, 2018 at 12:19:26AM -0300, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> Adopt the SPDX license identifier headers to ease license compliance
> management.
> 
> Signed-off-by: Fabio Estevam 
> ---
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)

Applied, thanks.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 2/2] drm/panel: seiko-43wvf1g: Add missing ">" character in author's email

2018-09-27 Thread Thierry Reding
On Thu, Jul 26, 2018 at 12:19:27AM -0300, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> There is a missing ">" character in Marco's email.
> 
> Fix it.
> 
> Signed-off-by: Fabio Estevam 
> ---
>  drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 68799] [APITRACE] Hyper-Z lockup with Falcon BMS 4.32u6 on CAYMAN

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=68799

--- Comment #9 from Stanisław Halik  ---
Last I know Hyper-Z was disabled due to few cases like this, and can be
re-enabled through the `SB_DEBUG' environment variable. It would be interesting
to see if r600 gallium-nine also exercises the freeze. The original freeze
happened using Wine's d3d9 -> opengl translation.

Sadly I cannot make a new trace as that 6970 gave up the ghost.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 0/5] Add CDTech 4.3" and 7" to panel-simple

2018-09-27 Thread Thierry Reding
On Tue, Jul 31, 2018 at 01:11:12AM +0200, Giulio Benetti wrote:
> Add CDTech 4.3" S043WQ26H-CT7 support
> Add CDTech 7" S070WV95-CT16 support
> 
> Giulio Benetti (5):
>   dt-bindings: Add vendor prefix for CDTech(H.K.) Electronics Limited
>   drm/panel: add panel CDTech S070WV95-CT16 to panel-simple
>   dt-bindings: Add CDTech S070WV95-CT16 panel bindings
>   drm/panel: add panel CDTech S043WQ26H-CT7 to panel-simple
>   dt-bindings: Add CDTech S043WQ26H-CT7 panel bindings
> 
>  .../display/panel/cdtech,s043wq26h-ct7.txt| 12 
>  .../display/panel/cdtech,s070wv95-ct16.txt| 12 
>  .../devicetree/bindings/vendor-prefixes.txt   |  1 +
>  drivers/gpu/drm/panel/panel-simple.c  | 55 +++
>  4 files changed, 80 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/cdtech,s043wq26h-ct7.txt
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/cdtech,s070wv95-ct16.txt

All applied, thanks. One small note, though: in the future please send
DT bindings patches before the driver patches. This is important because
checkpatch, which is run as pre-commit script, warns about undocumented
compatible strings if you send driver changes before the bindings.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/panel: p079zca: unconditionally remove the panel on removal

2018-09-27 Thread Thierry Reding
On Thu, Aug 16, 2018 at 04:09:20PM +0200, Heiko Stuebner wrote:
> There is no need to check innolux->base.dev when trying to remove
> the panel, as that variable is always set directly before the panel
> gets added and will still be available on panel_remove.
> 
> Signed-off-by: Heiko Stuebner 
> ---
>  drivers/gpu/drm/panel/panel-innolux-p079zca.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4] drm/panel: add Kingdisplay kd097d04 panel driver

2018-09-27 Thread Thierry Reding
On Fri, Aug 17, 2018 at 11:37:31AM +0200, Heiko Stuebner wrote:
> From: Nickey Yang 
> 
> Support Kingdisplay kd097d04 9.7" 1536x2048 TFT LCD panel,
> it is a MIPI dual-DSI panel.
> 
> v4:
> - address Philipp's comments
>   - real range for usleep_range and
>   - poweroff ordering in kingdisplay_panel_prepare
>   - return value beautification in panel_probe
> - update author naming for full name
> v3:
> - address Thierry's comments
>   - error handling for init dsi writes in init
>   - unconditionally remove the panel
>   - don't use drm_panel_detach
>   - a bit of variable signednes wiggling
> - I did talk to ChromeOS people and the delays really should be as short
>   as possible, so dropped the 100ms from the delay comments
> v2:
> - update timing + cmds from chromeos kernel
> - new backlight API including switch to devm_of_find_backlight
> - fix most of Sean Paul's comments
>   enable/prepare tracking seems something all panels do
> - document origins of the init sequence
> - lanes per dsi interface to 4 (two interfaces). Matches how tegra
>   and pending rockchip dual-dsi handle (dual-)dsi lanes
> - spdx header instead of license boilerplate
> 
> Signed-off-by: Nickey Yang 
> Signed-off-by: Heiko Stuebner 
> ---
>  drivers/gpu/drm/panel/Kconfig |  11 +
>  drivers/gpu/drm/panel/Makefile|   1 +
>  .../drm/panel/panel-kingdisplay-kd097d04.c| 473 ++
>  3 files changed, 485 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c

This is missing device tree bindings.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v8 1/2] drm/panel: Add support for Truly NT35597 panel driver

2018-09-27 Thread Thierry Reding
On Thu, Sep 20, 2018 at 03:52:36PM -0700, Abhinav Kumar wrote:
> From: "abhin...@codeaurora.org" 
> 
> Add support for Truly NT35597 panel driver used
> in MSM reference platforms.
> 
> This panel driver supports both single DSI and dual DSI
> modes.
> 
> However, this patch series adds support only for
> dual DSI mode.

Your lines are very short here. It's usually a good idea to keep the
subject line short, but there's no need to wrap this early in the rest
of the commit message. It's customary to use up to 72 characters.

> 
> Changes in v8:
> - Remove video mode config and headers
> - Remove unused macros
> - Try to avoid multi-lines wherever possible
> - Fix comments locations and make it concise
> - Fix return points in probe function
> 
> Signed-off-by: Archit Taneja 
> Signed-off-by: Abhinav Kumar 
> ---
>  drivers/gpu/drm/panel/Kconfig   |   7 +
>  drivers/gpu/drm/panel/Makefile  |   1 +
>  drivers/gpu/drm/panel/panel-truly-nt35597.c | 676 
> 
>  3 files changed, 684 insertions(+)
>  create mode 100644 drivers/gpu/drm/panel/panel-truly-nt35597.c
> 
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 6020c30..073ffa0 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -186,4 +186,11 @@ config DRM_PANEL_SITRONIX_ST7789V
> Say Y here if you want to enable support for the Sitronix
> ST7789V controller for 240x320 LCD panels
>  
> +config DRM_PANEL_TRULY_NT35597_WQXGA
> + tristate "Truly WQXGA"
> + depends on OF
> + depends on DRM_MIPI_DSI
> + help
> +   Say Y here if you want to enable support for Truly NT35597 WQXGA Dual 
> DSI
> +   Video Mode panel
>  endmenu
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index 5ccaaa9..80fd19f 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -19,3 +19,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += 
> panel-seiko-43wvf1g.o
>  obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
>  obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
>  obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
> +obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o
> diff --git a/drivers/gpu/drm/panel/panel-truly-nt35597.c 
> b/drivers/gpu/drm/panel/panel-truly-nt35597.c
> new file mode 100644
> index 000..c9e09e2
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-truly-nt35597.c
> @@ -0,0 +1,676 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (c) 2018, The Linux Foundation. All rights reserved.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +#include 
> +#include 
> +#include 

The headers should be sorted alphabetically.

> +
> +static const char * const regulator_names[] = {
> + "vdda",
> + "vdispp",
> + "vdispn",
> +};
> +
> +static unsigned long const regulator_enable_loads[] = {
> + 62000,
> + 10,
> + 10,
> +};
> +
> +static unsigned long const regulator_disable_loads[] = {
> + 80,
> + 100,
> + 100,
> +};
> +
> +struct nt35597_config {
> + u32 width_mm;
> + u32 height_mm;
> + const char *panel_name;
> + const void *panel_on_cmds;

Why void *? You define the correct data structure a few lines further
down, so you might as well just move that definition up and use the
proper data structure here. Then there'd be no need to cast this to
struct cmd_set * later on when you use it.

> + u32 num_on_cmds;
> + const struct drm_display_mode *dm;
> +};
> +
> +struct truly_nt35597 {
> + struct device *dev;
> + struct drm_panel panel;
> +
> + struct regulator_bulk_data supplies[ARRAY_SIZE(regulator_names)];
> +
> + struct gpio_desc *reset_gpio;
> + struct gpio_desc *mode_gpio;
> +
> + struct backlight_device *backlight;
> +
> + struct mipi_dsi_device *dsi[2];
> +
> + const struct nt35597_config *config;
> + bool prepared;
> + bool enabled;
> +};
> +
> +static inline struct truly_nt35597 *panel_to_ctx(struct drm_panel *panel)
> +{
> + return container_of(panel, struct truly_nt35597, panel);
> +}
> +
> +struct cmd_set {
> + u8 commands[4];
> + u8 size;
> +};
> +
> +static struct cmd_set qcom_2k_panel_magic_cmds[] = {

static const?

> + /* CMD2_P0 */
> + { { 0xff, 0x20 }, 2 },
> + { { 0xfb, 0x01 }, 2 },
> + { { 0x00, 0x01 }, 2 },
> + { { 0x01, 0x55 }, 2 },
> + { { 0x02, 0x45 }, 2 },
> + { { 0x05, 0x40 }, 2 },
> + { { 0x06, 0x19 }, 2 },
> + { { 0x07, 0x1e }, 2 },
> + { { 0x0b, 0x73 }, 2 },
> + { { 0x0c, 0x73 }, 2 },
> + { { 0x0e, 0xb0 }, 2 },
> + { { 0x0f, 0xae }, 2 },
> + { { 0x11, 0xb8 }, 2 },
> + { { 0x13, 0x00 }, 2 },
> + { { 0x58, 0x80 }, 2 },
> + { { 0x59, 0x01 }, 2 },
> + { { 0x5a, 0x00 }, 2 },
> + { { 0x5b, 0x01 }, 2 },
> + { 

Re: [PATCH v2 4/6] drm/panel: simple: Add support for Banana Pi 7" S070WV20-CT16 panel

2018-09-27 Thread Thierry Reding
On Fri, Sep 07, 2018 at 12:19:46PM +0800, Chen-Yu Tsai wrote:
> This panel is marketed as Banana Pi 7" LCD display. On the back is
> a sticker denoting the model name S070WV20-CT16.
> 
> This is a 7" 800x480 panel connected through a 24-bit RGB interface.
> However the panel only does 262k colors.
> 
> Depending on the variant, the PCB attached to the panel module either
> supports DSI, or DSI + 24-bit RGB. DSI is converted to 24-bit RGB via
> an onboard ICN6211 MIPI DSI - RGB bridge chip, then fed to the panel
> itself.
> 
> Signed-off-by: Chen-Yu Tsai 
> ---
>  .../display/panel/bananapi,s070wv20-ct16.txt  | 12 +
>  drivers/gpu/drm/panel/panel-simple.c  | 25 +++
>  2 files changed, 37 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/bananapi,s070wv20-ct16.txt

Next time, please make the bindings and driver changes separate patches.

Applied, thanks.
Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/panel: simple: Add DLC1010GIG panel

2018-09-27 Thread Thierry Reding
On Mon, Sep 24, 2018 at 05:26:10PM +0200, Marco Felsch wrote:
> Add support for the DLC DLC1010GIG 1280x800 10.1" LVDS panel to the
> simple-panel driver.
> 
> Signed-off-by: Marco Felsch 
> ---
>  .../bindings/display/panel/dlc,dlc1010gig.txt | 12 +++
>  drivers/gpu/drm/panel/panel-simple.c  | 33 +++
>  2 files changed, 45 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/dlc,dlc1010gig.txt

Please make DT bindings and driver changes separate patches next time,
otherwise checkpatch complains when applying.

Applied, thanks.

Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 09/11] drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()

2018-09-27 Thread Noralf Trønnes


Den 26.09.2018 22.26, skrev Stefan Agner:

On 08.12.2017 20:37, Noralf Trønnes wrote:

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.
Remove console.h inclusion which was forgotten when converting to the
suspend/resume helpers.

Just realized this never made it upstream. I guess its still valid and
could be applied?


It has been superseeded by this patch:

[03/20] drm/fsl-dcu: Use drm_fbdev_generic_setup()
https://patchwork.freedesktop.org/patch/247865/

Noralf.


--
Stefan


Cc: Stefan Agner 
Cc: Alison Wang 
Signed-off-by: Noralf Trønnes 
---
  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 26 ++
  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
  2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index 80232321a244..e487a2002783 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -11,7 +11,6 @@
  
  #include 

  #include 
-#include 
  #include 
  #include 
  #include 
@@ -25,6 +24,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -89,19 +89,15 @@ static int fsl_dcu_load(struct drm_device *dev,
unsigned long flags)
"Invalid legacyfb_depth.  Defaulting to 24bpp\n");
legacyfb_depth = 24;
}
-   fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1);
-   if (IS_ERR(fsl_dev->fbdev)) {
-   ret = PTR_ERR(fsl_dev->fbdev);
-   fsl_dev->fbdev = NULL;
+   ret = drm_fb_cma_fbdev_init(dev, legacyfb_depth, 1);
+   if (ret)
goto done;
-   }
  
  	return 0;

  done:
drm_kms_helper_poll_fini(dev);
  
-	if (fsl_dev->fbdev)

-   drm_fbdev_cma_fini(fsl_dev->fbdev);
+   drm_fb_cma_fbdev_fini(dev);
  
  	drm_mode_config_cleanup(dev);

drm_irq_uninstall(dev);
@@ -112,13 +108,10 @@ static int fsl_dcu_load(struct drm_device *dev,
unsigned long flags)
  
  static void fsl_dcu_unload(struct drm_device *dev)

  {
-   struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-
drm_atomic_helper_shutdown(dev);
drm_kms_helper_poll_fini(dev);
  
-	if (fsl_dev->fbdev)

-   drm_fbdev_cma_fini(fsl_dev->fbdev);
+   drm_fb_cma_fbdev_fini(dev);
  
  	drm_mode_config_cleanup(dev);

drm_irq_uninstall(dev);
@@ -147,19 +140,12 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
return IRQ_HANDLED;
  }
  
-static void fsl_dcu_drm_lastclose(struct drm_device *dev)

-{
-   struct fsl_dcu_drm_device *fsl_dev = dev->dev_private;
-
-   drm_fbdev_cma_restore_mode(fsl_dev->fbdev);
-}
-
  DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
  
  static struct drm_driver fsl_dcu_drm_driver = {

.driver_features= DRIVER_HAVE_IRQ | DRIVER_GEM | DRIVER_MODESET
| DRIVER_PRIME | DRIVER_ATOMIC,
-   .lastclose  = fsl_dcu_drm_lastclose,
+   .lastclose  = drm_fb_helper_lastclose,
.load   = fsl_dcu_load,
.unload = fsl_dcu_unload,
.irq_handler= fsl_dcu_drm_irq,
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
index 93bfb98012d4..cb87bb74cb87 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -191,7 +191,6 @@ struct fsl_dcu_drm_device {
/*protects hardware register*/
spinlock_t irq_lock;
struct drm_device *drm;
-   struct drm_fbdev_cma *fbdev;
struct drm_crtc crtc;
struct drm_encoder encoder;
struct fsl_dcu_drm_connector connector;


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/v3d: fix build error due to change in scheduler struct

2018-09-27 Thread Christian König

Am 27.09.2018 um 12:30 schrieb Nayan Deshmukh:

The work_tdr field was moved from drm_sched_job to drm_gpu_scheduler
as part of a previous patch.

Fixes: 4f07d88d8534 drm/scheduler: remove timeout work_struct from
drm_sched_job

Signed-off-by: Nayan Deshmukh 


I've squashed the two fixed together and pushed the result.

With a bit of luck Alex will squash them into the original patch before 
pushing it upstream.


Christian.


---
  drivers/gpu/drm/v3d/v3d_sched.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c
index a5501581d96b..9243dea6e6ad 100644
--- a/drivers/gpu/drm/v3d/v3d_sched.c
+++ b/drivers/gpu/drm/v3d/v3d_sched.c
@@ -168,7 +168,7 @@ v3d_job_timedout(struct drm_sched_job *sched_job)
job->timedout_ctca = ctca;
job->timedout_ctra = ctra;
  
-		schedule_delayed_work(&job->base.work_tdr,

+   schedule_delayed_work(&job->base.sched->work_tdr,
  job->base.sched->timeout);
return;
}


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/panel: simple: Add DLC1010GIG panel

2018-09-27 Thread Thierry Reding
On Mon, Sep 24, 2018 at 05:26:10PM +0200, Marco Felsch wrote:
> Add support for the DLC DLC1010GIG 1280x800 10.1" LVDS panel to the
> simple-panel driver.
> 
> Signed-off-by: Marco Felsch 
> ---
>  .../bindings/display/panel/dlc,dlc1010gig.txt | 12 +++
>  drivers/gpu/drm/panel/panel-simple.c  | 33 +++
>  2 files changed, 45 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/panel/dlc,dlc1010gig.txt

checkpatch complains about some minor issues. I've addressed most of
them while applying, but next time, please make sure to run checkpatch
and addressing the issues that it flags before sending.

Thanks,
Thierry


signature.asc
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 03/22] drm/arc: Use drm_fb_cma_fbdev_init/fini()

2018-09-27 Thread Noralf Trønnes


Den 27.09.2018 10.49, skrev Alexey Brodkin:

Hi Noralf,

On Wed, 2017-11-15 at 15:19 +0100, Noralf Trønnes wrote:

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.
Remove unused function prototype arcpgu_fbdev_cma_init().

Cc: Alexey Brodkin 
Signed-off-by: Noralf Trønnes 

Similarly to drm/fsl-dcu driver this one never made it upstream.
I was under impression that entire series will be either accepted or not
but looks like fixes for separate drivers were pulled via separate trees.

Anyways I like this patch for ARC PGU and may confirm it works
perfectly fine on top of 4.18.10 so should I pull this into my tree and
send a pull-request to David or maybe all not yet accepted patches from the
series may go through the same tree?

-Alexey

And essentially...
Acked-by: Alexey Brodkin 



It has been superseeded by this patch:

[02/20] drm/arc: Use drm_fbdev_generic_setup()
https://patchwork.freedesktop.org/patch/247862/

I'll reply to the cover letter of this series that it has been superseeded
and why.

Wrt to applying, I only do that if I get an ack from the driver maintainer
or a DRM maintainer for trivial stuff.
Some reply that they have applied/queued the patch in their tree for the
next version.

Noralf.

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH] Revert "drm/panel: Add device_link from panel device to DRM device"

2018-09-27 Thread Linus Walleij
This reverts commit 0c08754b59da5557532d946599854e6df28edc22.

commit 0c08754b59da
("drm/panel: Add device_link from panel device to DRM device")
creates a circular dependency under these circumstances:

1. The panel depends on dsi-host because it is MIPI-DSI child
   device.
2. dsi-host depends on the drm parent device (connector->dev->dev)
   this should be allowed.
3. drm parent dev (connector->dev->dev) depends on the panel
   after this patch.

This makes the dependency circular and while it appears it
does not affect any in-tree drivers (they do not seem to have
dsi hosts depending on the same parent device) this does not
seem right.

As noted in a response from Andrzej Hajda, the intent is
likely to make the panel dependent on the DRM device
(connector->dev) not its parent. But we have no way of
doing that since the DRM device doesn't contain any
struct device on its own (arguably it should).

Revert this until a proper approach is figured out.

Cc: Jyri Sarha 
Cc: Eric Anholt 
Cc: Andrzej Hajda 
Signed-off-by: Linus Walleij 
---
 drivers/gpu/drm/drm_panel.c | 10 --
 include/drm/drm_panel.h |  1 -
 2 files changed, 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index b902361dee6e..1d9a9d2fe0e0 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 
@@ -105,13 +104,6 @@ int drm_panel_attach(struct drm_panel *panel, struct 
drm_connector *connector)
if (panel->connector)
return -EBUSY;
 
-   panel->link = device_link_add(connector->dev->dev, panel->dev, 0);
-   if (!panel->link) {
-   dev_err(panel->dev, "failed to link panel to %s\n",
-   dev_name(connector->dev->dev));
-   return -EINVAL;
-   }
-
panel->connector = connector;
panel->drm = connector->dev;
 
@@ -133,8 +125,6 @@ EXPORT_SYMBOL(drm_panel_attach);
  */
 int drm_panel_detach(struct drm_panel *panel)
 {
-   device_link_del(panel->link);
-
panel->connector = NULL;
panel->drm = NULL;
 
diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
index 582a0ec0aa70..777814755fa6 100644
--- a/include/drm/drm_panel.h
+++ b/include/drm/drm_panel.h
@@ -89,7 +89,6 @@ struct drm_panel {
struct drm_device *drm;
struct drm_connector *connector;
struct device *dev;
-   struct device_link *link;
 
const struct drm_panel_funcs *funcs;
 
-- 
2.17.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 04/12] drm/sun4i: sun6i_mipi_dsi: Enable missing DSI bus clock

2018-09-27 Thread Chen-Yu Tsai
Hi,

On Thu, Sep 27, 2018 at 7:49 PM Jagan Teki  wrote:
>
> DSI bus_clk is already available in sun6i_dsi but missed to
> get the clk and process for enable/disable.
>
> This patch add support for it.
>
> Signed-off-by: Jagan Teki 
> ---
>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> index 8e9c76febca2..156b371243c6 100644
> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> @@ -1004,6 +1004,12 @@ static int sun6i_dsi_probe(struct platform_device 
> *pdev)
> return PTR_ERR(dsi->reset);
> }
>
> +   dsi->bus_clk = devm_clk_get(dev, "bus");
> +   if (IS_ERR(dsi->bus_clk)) {
> +   dev_err(dev, "Couldn't get the DSI bus clock\n");
> +   return PTR_ERR(dsi->bus_clk);
> +   }
> +

The DSI driver uses devm_regmap_init_mmio_clk, which enables the
clock behind the scenes when regmap access needs it enabled.

Did you have any issues without this patch?

ChenYu

> if (dsi->variant->has_mod_clk) {
> dsi->mod_clk = devm_clk_get(dev, "mod");
> if (IS_ERR(dsi->mod_clk)) {
> @@ -1012,6 +1018,7 @@ static int sun6i_dsi_probe(struct platform_device *pdev)
> }
> }
>
> +   clk_prepare_enable(dsi->bus_clk);
> /*
>  * In order to operate properly, that clock seems to be always
>  * set to 297MHz.
> @@ -1065,6 +1072,7 @@ static int sun6i_dsi_remove(struct platform_device 
> *pdev)
> sun6i_dphy_remove(dsi);
> if (dsi->variant->has_mod_clk)
> clk_rate_exclusive_put(dsi->mod_clk);
> +   clk_disable_unprepare(dsi->bus_clk);
>
> return 0;
>  }
> --
> 2.18.0.321.gffc6fa0e3
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v3 00/11] drm/cma-helper: Remove drm_fbdev_cma* functions

2018-09-27 Thread Noralf Trønnes


Den 08.12.2017 20.37, skrev Noralf Trønnes:

These are the remaining patches not applied due to missing review and:
- arm/hdlcd and rcar-du have started to use
   drm_fbdev_cma_set_suspend_unlocked() since last, so I have added patches
   converting them to drm_mode_config_helper_suspend/resume().
- tinydrm has gained a new driver ili9225

Noralf.


Just a note that this series has been superseeded by the generic fbdev
work. During Christmas I got the idea that maybe it was possible to do
generic fbdev using dumb buffers. A prototype for this was done in one
day, but it took months before it was mergeable due to a drm_client API
that had to be made.

So this is the superseeding series based on the generic fbdev work:

drm/cma-helper drivers: Use drm_fbdev_generic_setup()
https://patchwork.freedesktop.org/series/49382/


Noralf.



Noralf Trønnes (11):
   drm/arc: Use drm_fb_cma_fbdev_init/fini()
   drm/arm/hdlcd: Use drm_mode_config_helper_suspend/resume()
   drm/arm/hdlcd: Use drm_fb_cma_fbdev_init/fini()
   drm/hisilicon/kirin: Use drm_fb_cma_fbdev_init/fini()
   drm/meson: Use drm_fb_cma_fbdev_init/fini()
   drm/mxsfb: Use drm_fb_cma_fbdev_init/fini()
   drm/rcar-du: Use drm_mode_config_helper_suspend/resume()
   drm/rcar-du: Use drm_fb_cma_fbdev_init/fini()
   drm/fsl-dcu: Use drm_fb_cma_fbdev_init/fini()
   drm/tinydrm: Use drm_fb_cma_fbdev_init_with_funcs/fini()
   drm/cma-helper: Remove drm_fbdev_cma* functions

  Documentation/gpu/todo.rst  |   5 -
  drivers/gpu/drm/arc/arcpgu.h|   4 -
  drivers/gpu/drm/arc/arcpgu_drv.c|  36 ++
  drivers/gpu/drm/arm/hdlcd_drv.c |  62 ++
  drivers/gpu/drm/arm/hdlcd_drv.h |   2 -
  drivers/gpu/drm/drm_fb_cma_helper.c | 158 
  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c   |  26 +---
  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h   |   1 -
  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c |  35 +-
  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h |   4 -
  drivers/gpu/drm/meson/meson_drv.c   |  20 +--
  drivers/gpu/drm/meson/meson_drv.h   |   1 -
  drivers/gpu/drm/mxsfb/mxsfb_drv.c   |  21 +---
  drivers/gpu/drm/mxsfb/mxsfb_drv.h   |   1 -
  drivers/gpu/drm/rcar-du/rcar_du_drv.c   |  34 +
  drivers/gpu/drm/rcar-du/rcar_du_drv.h   |   3 -
  drivers/gpu/drm/rcar-du/rcar_du_kms.c   |  20 +--
  drivers/gpu/drm/tinydrm/core/tinydrm-core.c |  37 +-
  drivers/gpu/drm/tinydrm/ili9225.c   |   3 +-
  drivers/gpu/drm/tinydrm/mi0283qt.c  |   3 +-
  drivers/gpu/drm/tinydrm/st7586.c|   3 +-
  include/drm/drm_fb_cma_helper.h |  28 +
  include/drm/tinydrm/tinydrm.h   |   3 -
  23 files changed, 61 insertions(+), 449 deletions(-)



___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4] drm/panel: add Kingdisplay kd097d04 panel driver

2018-09-27 Thread Heiko Stuebner
Hi Thierry,

Am Donnerstag, 27. September 2018, 14:07:21 CEST schrieb Thierry Reding:
> On Fri, Aug 17, 2018 at 11:37:31AM +0200, Heiko Stuebner wrote:
> > From: Nickey Yang 
> > 
> > Support Kingdisplay kd097d04 9.7" 1536x2048 TFT LCD panel,
> > it is a MIPI dual-DSI panel.
> > 
> > v4:
> > - address Philipp's comments
> >   - real range for usleep_range and
> >   - poweroff ordering in kingdisplay_panel_prepare
> >   - return value beautification in panel_probe
> > - update author naming for full name
> > v3:
> > - address Thierry's comments
> >   - error handling for init dsi writes in init
> >   - unconditionally remove the panel
> >   - don't use drm_panel_detach
> >   - a bit of variable signednes wiggling
> > - I did talk to ChromeOS people and the delays really should be as short
> >   as possible, so dropped the 100ms from the delay comments
> > v2:
> > - update timing + cmds from chromeos kernel
> > - new backlight API including switch to devm_of_find_backlight
> > - fix most of Sean Paul's comments
> >   enable/prepare tracking seems something all panels do
> > - document origins of the init sequence
> > - lanes per dsi interface to 4 (two interfaces). Matches how tegra
> >   and pending rockchip dual-dsi handle (dual-)dsi lanes
> > - spdx header instead of license boilerplate
> > 
> > Signed-off-by: Nickey Yang 
> > Signed-off-by: Heiko Stuebner 
> > ---
> >  drivers/gpu/drm/panel/Kconfig |  11 +
> >  drivers/gpu/drm/panel/Makefile|   1 +
> >  .../drm/panel/panel-kingdisplay-kd097d04.c| 473 ++
> >  3 files changed, 485 insertions(+)
> >  create mode 100644 drivers/gpu/drm/panel/panel-kingdisplay-kd097d04.c
> 
> This is missing device tree bindings.

nope it isn't ... as you already applied those from v3 [0]

Heiko

[0] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/display/panel/kingdisplay,kd097d04.txt


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108049] [vega10] amdgpu fails to either wake up the GPU or while putting it to sleep

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108049

--- Comment #3 from Nicholas Kazlauskas  ---
The kernel you want to try for the latest amdgpu code is the
amd-staging-drm-next branch from the repository linked:

https://cgit.freedesktop.org/~agd5f/linux/

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm: stm: implement get_scanout_position function

2018-09-27 Thread Benjamin Gaignard
Le jeu. 27 sept. 2018 à 13:32, Yannick FERTRE  a écrit :
>
> Reviewed-by: Yannick Fertré 
> Tested-by: Yannick Fertré 

Applied on drm-misc-next,
Thanks,
Benjamin

>
> On 09/27/2018 10:15 AM, Yannick FERTRE wrote:
> > Reviewed-by/tested-by: yannick.fer...@st.com
> >
> >  Forwarded Message 
> > Subject: [PATCH] drm: stm: implement get_scanout_position function
> > Date: Fri, 29 Jun 2018 15:01:40 +0200
> > From: Benjamin Gaignard 
> > To: yannick.fer...@st.com, philippe.co...@st.com, airl...@linux.ie
> > CC: dri-devel@lists.freedesktop.org, linux-ker...@vger.kernel.org,
> > Benjamin Gaignard , Benjamin Gaignard
> > 
> >
> > Hardware allow to read the position in scanout buffer so
> > we can use this information to make wait of vblank more accurate.
> >
> > Active area bounds (start, end, total height) have already been
> > computed and written in ltdc registers, read them and get the
> > current line position to compute vpos value.
> >
> > Signed-off-by: Benjamin Gaignard 
> > ---
> >   drivers/gpu/drm/stm/drv.c  |  2 ++
> >   drivers/gpu/drm/stm/ltdc.c | 45
> > +
> >   drivers/gpu/drm/stm/ltdc.h |  5 +
> >   3 files changed, 52 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> > index 8698e08313e1..ac53383350e3 100644
> > --- a/drivers/gpu/drm/stm/drv.c
> > +++ b/drivers/gpu/drm/stm/drv.c
> > @@ -72,6 +72,8 @@ static struct drm_driver drv_driver = {
> >   .gem_prime_vmap = drm_gem_cma_prime_vmap,
> >   .gem_prime_vunmap = drm_gem_cma_prime_vunmap,
> >   .gem_prime_mmap = drm_gem_cma_prime_mmap,
> > +.get_scanout_position = ltdc_crtc_scanoutpos,
> > +.get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos,
> >   };
> >static int drv_load(struct drm_device *ddev)
> > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> > index d997a6014d6c..05b714673042 100644
> > --- a/drivers/gpu/drm/stm/ltdc.c
> > +++ b/drivers/gpu/drm/stm/ltdc.c
> > @@ -148,6 +148,8 @@
> >   #define IER_TERRIEBIT(2)/* Transfer ERRor Interrupt
> > Enable */
> >   #define IER_RRIEBIT(3)/* Register Reload Interrupt
> > enable */
> >   +#define CPSR_CYPOSGENMASK(15, 0)/* Current Y position */
> > +
> >   #define ISR_LIFBIT(0)/* Line Interrupt Flag */
> >   #define ISR_FUIFBIT(1)/* Fifo Underrun Interrupt Flag */
> >   #define ISR_TERRIFBIT(2)/* Transfer ERRor Interrupt Flag */
> > @@ -622,6 +624,49 @@ static void ltdc_crtc_disable_vblank(struct
> > drm_crtc *crtc)
> >   reg_clear(ldev->regs, LTDC_IER, IER_LIE);
> >   }
> >   +bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe,
> > +  bool in_vblank_irq, int *vpos, int *hpos,
> > +  ktime_t *stime, ktime_t *etime,
> > +  const struct drm_display_mode *mode)
> > +{
> > +struct ltdc_device *ldev = ddev->dev_private;
> > +int line, vactive_start, vactive_end, vtotal;
> > +
> > +if (stime)
> > +*stime = ktime_get();
> > +
> > +/* The active area starts after vsync + front porch and ends
> > + * at vsync + front porc + display size.
> > + * The total height also include back porch.
> > + * We have 3 possible cases to handle:
> > + * - line < vactive_start: vpos = line - vactive_start and will be
> > + * negative
> > + * - vactive_start < line < vactive_end: vpos = line - vactive_start
> > + * and will be positive
> > + * - line > vactive_end: vpos = line - vtotal - vactive_start
> > + * and will negative
> > + *
> > + * Computation for the two first cases are identical so we can
> > + * simplify the code and only test if line > vactive_end
> > + */
> > +line = reg_read(ldev->regs, LTDC_CPSR) & CPSR_CYPOS;
> > +vactive_start = reg_read(ldev->regs, LTDC_BPCR) & BPCR_AVBP;
> > +vactive_end = reg_read(ldev->regs, LTDC_AWCR) & AWCR_AAH;
> > +vtotal = reg_read(ldev->regs, LTDC_TWCR) & TWCR_TOTALH;
> > +
> > +if (line > vactive_end)
> > +*vpos = line - vtotal - vactive_start;
> > +else
> > +*vpos = line - vactive_start;
> > +
> > +*hpos = 0;
> > +
> > +if (etime)
> > +*etime = ktime_get();
> > +
> > +return true;
> > +}
> > +
> >   static const struct drm_crtc_funcs ltdc_crtc_funcs = {
> >   .destroy = drm_crtc_cleanup,
> >   .set_config = drm_atomic_helper_set_config,
> > diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h
> > index 1e16d6afb0d2..b8c5cc41e17a 100644
> > --- a/drivers/gpu/drm/stm/ltdc.h
> > +++ b/drivers/gpu/drm/stm/ltdc.h
> > @@ -37,6 +37,11 @@ struct ltdc_device {
> >   struct fps_info plane_fpsi[LTDC_MAX_LAYER];
> >   };
> >   +bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
> > +  bool in_vblank_irq, int *vpos, int *hpos,
> > +  ktime_t *stime, ktime_t *etime,
> > +  const struct drm_displ

[Bug 108086] mesa 18.2.x line is crashing and disabling kwin_x11 and effects thereof, no problem with 18.1.x

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108086

Bug ID: 108086
   Summary: mesa 18.2.x line is crashing and disabling kwin_x11
and effects thereof, no problem with 18.1.x
   Product: Mesa
   Version: 18.2
  Hardware: Other
OS: All
Status: NEW
  Severity: normal
  Priority: medium
 Component: Drivers/DRI/i915
  Assignee: dri-devel@lists.freedesktop.org
  Reporter: jeckfer...@gmail.com
QA Contact: dri-devel@lists.freedesktop.org

Created attachment 141760
  --> https://bugs.freedesktop.org/attachment.cgi?id=141760&action=edit
various 18.2.x mesa crashing kwin_x11; not before 18.2.x

The gpu is intel 4th gen.
I have my 2nd gen laptop which is fine with 18.2.x.
I use Arch Linux.
I've encounter the problem before.
I hesitate to open an issue because I think it'll eventually be ok after a
release or next.
All of the 18.2.x is affected. But not 18.1.x line.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 106940] Black screen on KMS with 4.18.0-rc1 with Kaveri+Topaz, amdgpu, dc=1

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106940

--- Comment #43 from Nicholas Kazlauskas  ---
Did you get around to trying Alex's patch? Does the black screen still occur
with it?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [Intel-gfx] [RFC 1/3] drm: Add colorspace property

2018-09-27 Thread Ville Syrjälä
On Thu, Sep 27, 2018 at 04:29:52AM +, Shankar, Uma wrote:
> 
> 
> >-Original Message-
> >From: Ville Syrjälä [mailto:ville.syrj...@linux.intel.com]
> >Sent: Wednesday, September 26, 2018 3:12 PM
> >To: Maarten Lankhorst 
> >Cc: Shankar, Uma ; Adam Jackson
> >; intel-...@lists.freedesktop.org; dri-
> >de...@lists.freedesktop.org; Syrjala, Ville ; 
> >Lankhorst,
> >Maarten 
> >Subject: Re: [Intel-gfx] [RFC 1/3] drm: Add colorspace property
> >
> >On Wed, Sep 26, 2018 at 11:08:37AM +0200, Maarten Lankhorst wrote:
> >> Op 01-08-18 om 16:01 schreef Shankar, Uma:
> >> >
> >> >> -Original Message-
> >> >> From: Adam Jackson [mailto:a...@redhat.com]
> >> >> Sent: Wednesday, August 1, 2018 1:24 AM
> >> >> To: Shankar, Uma ;
> >> >> intel-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org
> >> >> Cc: Syrjala, Ville ; Lankhorst, Maarten
> >> >> 
> >> >> Subject: Re: [RFC 1/3] drm: Add colorspace property
> >> >>
> >> >> On Tue, 2018-07-24 at 21:15 +0530, Uma Shankar wrote:
> >> >>
> >> >>> --- a/include/uapi/drm/drm_mode.h
> >> >>> +++ b/include/uapi/drm/drm_mode.h
> >> >>> @@ -209,6 +209,17 @@
> >> >>>  #define DRM_MODE_CONTENT_PROTECTION_DESIRED 1
> >> >>>  #define DRM_MODE_CONTENT_PROTECTION_ENABLED 2
> >> >>>
> >> >>> +enum extended_colorimetry {
> >> >>> +  EXTENDED_COLORIMETRY_XV_YCC_601 = 0,
> >> >>> +  EXTENDED_COLORIMETRY_XV_YCC_709,
> >> >>> +  EXTENDED_COLORIMETRY_S_YCC_601,
> >> >>> +  EXTENDED_COLORIMETRY_ADOBE_YCC_601,
> >> >>> +  EXTENDED_COLORIMETRY_ADOBE_RGB,
> >> >>> +  EXTENDED_COLORIMETRY_BT2020_RGB,
> >> >>> +  EXTENDED_COLORIMETRY_BT2020_YCC,
> >> >>> +  EXTENDED_COLORIMETRY_BT2020_CYCC, };
> >> >> This doesn't give any way to distinguish "not set" from BT.601,
> >> >> which I'm not sure I like.
> >> > This enum gives a list of all possible colorspace which can be set on 
> >> > the sink
> >device.
> >> > The compositors/userspace can choose one of them, based on the
> >> > capabilities of sink as well as based on rendering/blending policies
> >> > which are designed to take advantage of hardware resources available.
> >> >
> >> > If you suggest to add something like NO_COLORSPACE_SET = -1, I can
> >> > add that to this enum list.
> >> I would add a default, but not sure I would introduce a new enum.
> >> hdmi_extended_colorimetry is already available.
> >
> >Yeah, there should be a default entry for "driver automagically picks 
> >something
> >suitable".
> >
> 
> Ok got it, will add a default option to the list.
> 
> >I think the enum prop should also be some kind of superset of all
> >CEA-861 normal+extended colorimetry options and DP MSA+VSC SDP colorimetry
> >options. The current list seems a bit incomplete to me.
> >
> 
> So should I keep this enum and append DP MSA +VSC SDP options to the list ?
> We can then have encoder specific enums separate from this global colorpsace
> enum. 

My original idea was one enum and each encoder type can then pick
the ones it can support by passing in the appropriate bitmask. That's
assuming we can reconcile any differences between DP and HDMI in
a nice way.

-- 
Ville Syrjälä
Intel
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] Revert "drm/panel: Add device_link from panel device to DRM device"

2018-09-27 Thread Sean Paul

[actually Cc Eric and Andrzej]

On Thu, Sep 27, 2018 at 02:41:30PM +0200, Linus Walleij wrote:
> This reverts commit 0c08754b59da5557532d946599854e6df28edc22.
> 
> commit 0c08754b59da
> ("drm/panel: Add device_link from panel device to DRM device")
> creates a circular dependency under these circumstances:
> 
> 1. The panel depends on dsi-host because it is MIPI-DSI child
>device.
> 2. dsi-host depends on the drm parent device (connector->dev->dev)
>this should be allowed.
> 3. drm parent dev (connector->dev->dev) depends on the panel
>after this patch.
> 
> This makes the dependency circular and while it appears it
> does not affect any in-tree drivers (they do not seem to have
> dsi hosts depending on the same parent device) this does not
> seem right.

Hey Linus,
I'm trying to wrap my head around this :-)

I just read through the original patch thread. It doesn't seem like this was
introduced to fix a bug? Will reverting this cause regressions on in-tree
drivers?

What's different in your in-development driver that's causing you to hit
this?

Thanks!

Sean

> 
> As noted in a response from Andrzej Hajda, the intent is
> likely to make the panel dependent on the DRM device
> (connector->dev) not its parent. But we have no way of
> doing that since the DRM device doesn't contain any
> struct device on its own (arguably it should).
> 
> Revert this until a proper approach is figured out.
> 
> Cc: Jyri Sarha 
> Cc: Eric Anholt 
> Cc: Andrzej Hajda 
> Signed-off-by: Linus Walleij 
> ---
>  drivers/gpu/drm/drm_panel.c | 10 --
>  include/drm/drm_panel.h |  1 -
>  2 files changed, 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index b902361dee6e..1d9a9d2fe0e0 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -24,7 +24,6 @@
>  #include 
>  #include 
>  
> -#include 
>  #include 
>  #include 
>  
> @@ -105,13 +104,6 @@ int drm_panel_attach(struct drm_panel *panel, struct 
> drm_connector *connector)
>   if (panel->connector)
>   return -EBUSY;
>  
> - panel->link = device_link_add(connector->dev->dev, panel->dev, 0);
> - if (!panel->link) {
> - dev_err(panel->dev, "failed to link panel to %s\n",
> - dev_name(connector->dev->dev));
> - return -EINVAL;
> - }
> -
>   panel->connector = connector;
>   panel->drm = connector->dev;
>  
> @@ -133,8 +125,6 @@ EXPORT_SYMBOL(drm_panel_attach);
>   */
>  int drm_panel_detach(struct drm_panel *panel)
>  {
> - device_link_del(panel->link);
> -
>   panel->connector = NULL;
>   panel->drm = NULL;
>  
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 582a0ec0aa70..777814755fa6 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -89,7 +89,6 @@ struct drm_panel {
>   struct drm_device *drm;
>   struct drm_connector *connector;
>   struct device *dev;
> - struct device_link *link;
>  
>   const struct drm_panel_funcs *funcs;
>  
> -- 
> 2.17.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108086] mesa 18.2.x line is crashing and disabling kwin_x11 and effects thereof, no problem with 18.1.x

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108086

--- Comment #1 from Denis  ---
hi, could you please clarify the CPU model?

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [linux-sunxi] Re: [PATCH 04/12] drm/sun4i: sun6i_mipi_dsi: Enable missing DSI bus clock

2018-09-27 Thread Chen-Yu Tsai
On Thu, Sep 27, 2018 at 9:44 PM Jagan Teki  wrote:
>
> On Thu, Sep 27, 2018 at 6:13 PM Chen-Yu Tsai  wrote:
> >
> > Hi,
> >
> > On Thu, Sep 27, 2018 at 7:49 PM Jagan Teki  
> > wrote:
> > >
> > > DSI bus_clk is already available in sun6i_dsi but missed to
> > > get the clk and process for enable/disable.
> > >
> > > This patch add support for it.
> > >
> > > Signed-off-by: Jagan Teki 
> > > ---
> > >  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 
> > >  1 file changed, 8 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> > > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > index 8e9c76febca2..156b371243c6 100644
> > > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> > > @@ -1004,6 +1004,12 @@ static int sun6i_dsi_probe(struct platform_device 
> > > *pdev)
> > > return PTR_ERR(dsi->reset);
> > > }
> > >
> > > +   dsi->bus_clk = devm_clk_get(dev, "bus");
> > > +   if (IS_ERR(dsi->bus_clk)) {
> > > +   dev_err(dev, "Couldn't get the DSI bus clock\n");
> > > +   return PTR_ERR(dsi->bus_clk);
> > > +   }
> > > +
> >
> > The DSI driver uses devm_regmap_init_mmio_clk, which enables the
> > clock behind the scenes when regmap access needs it enabled.
> >
> > Did you have any issues without this patch?
>
> I'm unable to read register values via devmem, I see all 0's for all
> dsi reg space.

Well that is to be expected given how mmio with clk regmap works.
Did you encounter any other problems besides this?

FYI you can dump regmap contents using /sys/kernel/debug/regmap/*/registers

ChenYu
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108086] mesa 18.2.x line is crashing and disabling kwin_x11 and effects thereof, no problem with 18.1.x

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108086

--- Comment #2 from jeckfer...@gmail.com ---
CPU model is intel haswell pentium.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] Revert "drm/panel: Add device_link from panel device to DRM device"

2018-09-27 Thread Andrzej Hajda
On 27.09.2018 15:50, Sean Paul wrote:
> [actually Cc Eric and Andrzej]
>
> On Thu, Sep 27, 2018 at 02:41:30PM +0200, Linus Walleij wrote:
>> This reverts commit 0c08754b59da5557532d946599854e6df28edc22.
>>
>> commit 0c08754b59da
>> ("drm/panel: Add device_link from panel device to DRM device")
>> creates a circular dependency under these circumstances:
>>
>> 1. The panel depends on dsi-host because it is MIPI-DSI child
>>device.
>> 2. dsi-host depends on the drm parent device (connector->dev->dev)
>>this should be allowed.
>> 3. drm parent dev (connector->dev->dev) depends on the panel
>>after this patch.
>>
>> This makes the dependency circular and while it appears it
>> does not affect any in-tree drivers (they do not seem to have
>> dsi hosts depending on the same parent device) this does not
>> seem right.
> Hey Linus,
> I'm trying to wrap my head around this :-)
>
> I just read through the original patch thread. It doesn't seem like this was
> introduced to fix a bug? Will reverting this cause regressions on in-tree
> drivers?

As I wrote in original patch thread, the original patch breaks platforms
with exynos-dsi encoder.
Quite detailed explanation in the original thread [1], 1st response to
the patch.
Apparently my response was ignored :)

[1]: https://patchwork.freedesktop.org/patch/218878/

Regards
Andrzej

>
> What's different in your in-development driver that's causing you to hit
> this?
>
> Thanks!
>
> Sean
>
>> As noted in a response from Andrzej Hajda, the intent is
>> likely to make the panel dependent on the DRM device
>> (connector->dev) not its parent. But we have no way of
>> doing that since the DRM device doesn't contain any
>> struct device on its own (arguably it should).
>>
>> Revert this until a proper approach is figured out.
>>
>> Cc: Jyri Sarha 
>> Cc: Eric Anholt 
>> Cc: Andrzej Hajda 
>> Signed-off-by: Linus Walleij 
>> ---
>>  drivers/gpu/drm/drm_panel.c | 10 --
>>  include/drm/drm_panel.h |  1 -
>>  2 files changed, 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
>> index b902361dee6e..1d9a9d2fe0e0 100644
>> --- a/drivers/gpu/drm/drm_panel.c
>> +++ b/drivers/gpu/drm/drm_panel.c
>> @@ -24,7 +24,6 @@
>>  #include 
>>  #include 
>>  
>> -#include 
>>  #include 
>>  #include 
>>  
>> @@ -105,13 +104,6 @@ int drm_panel_attach(struct drm_panel *panel, struct 
>> drm_connector *connector)
>>  if (panel->connector)
>>  return -EBUSY;
>>  
>> -panel->link = device_link_add(connector->dev->dev, panel->dev, 0);
>> -if (!panel->link) {
>> -dev_err(panel->dev, "failed to link panel to %s\n",
>> -dev_name(connector->dev->dev));
>> -return -EINVAL;
>> -}
>> -
>>  panel->connector = connector;
>>  panel->drm = connector->dev;
>>  
>> @@ -133,8 +125,6 @@ EXPORT_SYMBOL(drm_panel_attach);
>>   */
>>  int drm_panel_detach(struct drm_panel *panel)
>>  {
>> -device_link_del(panel->link);
>> -
>>  panel->connector = NULL;
>>  panel->drm = NULL;
>>  
>> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
>> index 582a0ec0aa70..777814755fa6 100644
>> --- a/include/drm/drm_panel.h
>> +++ b/include/drm/drm_panel.h
>> @@ -89,7 +89,6 @@ struct drm_panel {
>>  struct drm_device *drm;
>>  struct drm_connector *connector;
>>  struct device *dev;
>> -struct device_link *link;
>>  
>>  const struct drm_panel_funcs *funcs;
>>  
>> -- 
>> 2.17.1
>>
>> ___
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] drm/amd/powerplay: Change id parameter type in pp_atomfwctrl_get_clk_information_by_clkid

2018-09-27 Thread Alex Deucher
Applied.  thanks!

Alex
On Sat, Sep 22, 2018 at 2:29 AM Nathan Chancellor
 wrote:
>
> Clang generates warnings when one enumerated type is implicitly
> converted to another.
>
> drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/ppatomfwctrl.c:532:57:
> warning: implicit conversion from enumeration type 'enum
> atom_smu11_syspll0_clock_id' to different enumeration type 'BIOS_CLKID'
>   (aka 'enum atom_smu9_syspll0_clock_id') [-Wenum-conversion]
> if (!pp_atomfwctrl_get_clk_information_by_clkid(hwmgr,
> SMU11_SYSPLL0_SOCCLK_ID, &frequency))
>
> In this case, that is expected behavior. To make that clear to Clang
> without explicitly casting these values, change id's type to uint8_t
> in pp_atomfwctrl_get_clk_information_by_clkid so no conversion happens.
>
> Reported-by: Nick Desaulniers 
> Signed-off-by: Nathan Chancellor 
> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c | 3 ++-
>  drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.h | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c 
> b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
> index d27c1c9df286..4588bddf8b33 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.c
> @@ -488,7 +488,8 @@ int pp_atomfwctrl_get_gpio_information(struct pp_hwmgr 
> *hwmgr,
> return 0;
>  }
>
> -int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr, 
> BIOS_CLKID id, uint32_t *frequency)
> +int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr,
> +  uint8_t id, uint32_t 
> *frequency)
>  {
> struct amdgpu_device *adev = hwmgr->adev;
> struct atom_get_smu_clock_info_parameters_v3_1   parameters;
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.h 
> b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.h
> index 22e21668c93a..fe9e8ceef50e 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.h
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomfwctrl.h
> @@ -236,7 +236,7 @@ int pp_atomfwctrl_get_vbios_bootup_values(struct pp_hwmgr 
> *hwmgr,
>  int pp_atomfwctrl_get_smc_dpm_information(struct pp_hwmgr *hwmgr,
> struct pp_atomfwctrl_smc_dpm_parameters *param);
>  int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr,
> -   BIOS_CLKID id, uint32_t *frequency);
> +   uint8_t id, uint32_t *frequency);
>
>  #endif
>
> --
> 2.19.0
>
> ___
> amd-gfx mailing list
> amd-...@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108086] mesa 18.2.x line is crashing and disabling kwin_x11 and effects thereof, no problem with 18.1.x

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108086

jeckfer...@gmail.com changed:

   What|Removed |Added

 OS|All |Linux (All)
   Severity|normal  |blocker
   Hardware|Other   |x86-64 (AMD64)

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH] Revert "drm/panel: Add device_link from panel device to DRM device"

2018-09-27 Thread Sean Paul
On Thu, Sep 27, 2018 at 04:25:56PM +0200, Andrzej Hajda wrote:
> On 27.09.2018 15:50, Sean Paul wrote:
> > [actually Cc Eric and Andrzej]
> >
> > On Thu, Sep 27, 2018 at 02:41:30PM +0200, Linus Walleij wrote:
> >> This reverts commit 0c08754b59da5557532d946599854e6df28edc22.
> >>
> >> commit 0c08754b59da
> >> ("drm/panel: Add device_link from panel device to DRM device")
> >> creates a circular dependency under these circumstances:
> >>
> >> 1. The panel depends on dsi-host because it is MIPI-DSI child
> >>device.
> >> 2. dsi-host depends on the drm parent device (connector->dev->dev)
> >>this should be allowed.
> >> 3. drm parent dev (connector->dev->dev) depends on the panel
> >>after this patch.
> >>
> >> This makes the dependency circular and while it appears it
> >> does not affect any in-tree drivers (they do not seem to have
> >> dsi hosts depending on the same parent device) this does not
> >> seem right.
> > Hey Linus,
> > I'm trying to wrap my head around this :-)
> >
> > I just read through the original patch thread. It doesn't seem like this was
> > introduced to fix a bug? Will reverting this cause regressions on in-tree
> > drivers?
> 
> As I wrote in original patch thread, the original patch breaks platforms
> with exynos-dsi encoder.
> Quite detailed explanation in the original thread [1], 1st response to
> the patch.
> Apparently my response was ignored :)

Thanks Andrzej,
I've pushed this to drm-misc-fixes. It'll go out this week or next.

Thanks,

Sean

> 
> [1]: https://patchwork.freedesktop.org/patch/218878/
> 
> Regards
> Andrzej
> 
> >
> > What's different in your in-development driver that's causing you to hit
> > this?
> >
> > Thanks!
> >
> > Sean
> >
> >> As noted in a response from Andrzej Hajda, the intent is
> >> likely to make the panel dependent on the DRM device
> >> (connector->dev) not its parent. But we have no way of
> >> doing that since the DRM device doesn't contain any
> >> struct device on its own (arguably it should).
> >>
> >> Revert this until a proper approach is figured out.
> >>
> >> Cc: Jyri Sarha 
> >> Cc: Eric Anholt 
> >> Cc: Andrzej Hajda 
> >> Signed-off-by: Linus Walleij 
> >> ---
> >>  drivers/gpu/drm/drm_panel.c | 10 --
> >>  include/drm/drm_panel.h |  1 -
> >>  2 files changed, 11 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> >> index b902361dee6e..1d9a9d2fe0e0 100644
> >> --- a/drivers/gpu/drm/drm_panel.c
> >> +++ b/drivers/gpu/drm/drm_panel.c
> >> @@ -24,7 +24,6 @@
> >>  #include 
> >>  #include 
> >>  
> >> -#include 
> >>  #include 
> >>  #include 
> >>  
> >> @@ -105,13 +104,6 @@ int drm_panel_attach(struct drm_panel *panel, struct 
> >> drm_connector *connector)
> >>if (panel->connector)
> >>return -EBUSY;
> >>  
> >> -  panel->link = device_link_add(connector->dev->dev, panel->dev, 0);
> >> -  if (!panel->link) {
> >> -  dev_err(panel->dev, "failed to link panel to %s\n",
> >> -  dev_name(connector->dev->dev));
> >> -  return -EINVAL;
> >> -  }
> >> -
> >>panel->connector = connector;
> >>panel->drm = connector->dev;
> >>  
> >> @@ -133,8 +125,6 @@ EXPORT_SYMBOL(drm_panel_attach);
> >>   */
> >>  int drm_panel_detach(struct drm_panel *panel)
> >>  {
> >> -  device_link_del(panel->link);
> >> -
> >>panel->connector = NULL;
> >>panel->drm = NULL;
> >>  
> >> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> >> index 582a0ec0aa70..777814755fa6 100644
> >> --- a/include/drm/drm_panel.h
> >> +++ b/include/drm/drm_panel.h
> >> @@ -89,7 +89,6 @@ struct drm_panel {
> >>struct drm_device *drm;
> >>struct drm_connector *connector;
> >>struct device *dev;
> >> -  struct device_link *link;
> >>  
> >>const struct drm_panel_funcs *funcs;
> >>  
> >> -- 
> >> 2.17.1
> >>
> >> ___
> >> dri-devel mailing list
> >> dri-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> 

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 108086] mesa 18.2.x line is crashing and disabling kwin_x11 and effects thereof, no problem with 18.1.x

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=108086

Mike Lothian  changed:

   What|Removed |Added

 CC||m...@fireburn.co.uk

--- Comment #3 from Mike Lothian  ---
Might be worth deleting the Mesa shader cache and the Qt shader cache

~/.cache/mesa_shader_cache
~/.cache/qtshadercache

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH 06/12] drm/sun4i: sun6i_mipi_dsi: Fix VBP size calculation

2018-09-27 Thread Maxime Ripard
On Thu, Sep 27, 2018 at 05:18:44PM +0530, Jagan Teki wrote:
> According to horizontal and vertical timings are defined
> per the diagram from include/drm/drm_modes.h
> 
> Back porch = [hv]total - [hv]sync_end
>
> So, update SUN6I_DSI_BASIC_SIZE0_VBP calculation as
> mode->vtotal - mode->vsync_end
> 
> Signed-off-by: Jagan Teki 
> ---
>  drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c 
> b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> index 1c7e42015645..599284971ab6 100644
> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
> @@ -526,8 +526,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
>   regmap_write(dsi->regs, SUN6I_DSI_BASIC_SIZE0_REG,
>SUN6I_DSI_BASIC_SIZE0_VSA(mode->vsync_end -
>  mode->vsync_start) |
> -  SUN6I_DSI_BASIC_SIZE0_VBP(mode->vsync_start -
> -mode->vdisplay));
> +  SUN6I_DSI_BASIC_SIZE0_VBP(mode->vtotal -
> +mode->vsync_end));

Is it purely theoretical, or did you find some source that back that?

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[Bug 106940] Black screen on KMS with 4.18.0-rc1 with Kaveri+Topaz, amdgpu, dc=1

2018-09-27 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=106940

--- Comment #44 from SET  ---
(In reply to Nicholas Kazlauskas from comment #43)
> Did you get around to trying Alex's patch? Does the black screen still occur
> with it?

Please see comment #29.

No black screen with the patch. But suspend will subsequently fail.

-- 
You are receiving this mail because:
You are the assignee for the bug.___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PULL] drm-misc-fixes

2018-09-27 Thread Sean Paul

Hi Dave,
Linus posted the device_link revert after Maarten's PR earlier today, and I
figured it was worthwhile enough to warrant a second pull. So here is Maarten's
pull along with Linus' revert.

Apologies for the extra mail :/

drm-misc-fixes-2018-09-27-1:
- Revert adding device-link to panels

Cheers, Sean


The following changes since commit 6bf4ca7fbc85d80446ac01c0d1d77db4d91a6d84:

  Linux 4.19-rc5 (2018-09-23 19:15:18 +0200)

are available in the Git repository at:

  git://anongit.freedesktop.org/drm/drm-misc tags/drm-misc-fixes-2018-09-27-1

for you to fetch changes up to d6a77ba0eb92d8ffa4b05a442fc20d0a9b11c4c4:

  Revert "drm/panel: Add device_link from panel device to DRM device" 
(2018-09-27 11:00:42 -0400)


- Revert adding device-link to panels


Jason Ekstrand (1):
  drm/syncobj: Don't leak fences when WAIT_FOR_SUBMIT is set

Linus Walleij (1):
  Revert "drm/panel: Add device_link from panel device to DRM device"

 drivers/gpu/drm/drm_panel.c   | 10 --
 drivers/gpu/drm/drm_syncobj.c |  5 +
 include/drm/drm_panel.h   |  1 -
 3 files changed, 5 insertions(+), 11 deletions(-)

-- 
Sean Paul, Software Engineer, Google / Chromium OS
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   >